How can I print the unicode box drawing characters in python:
print u'\u2500'
print u'\u2501'
print u'\u2502'
print u'\u2503'
print u'\u2504'
Traceback (most recent call last):
File "\test.py", line 3, in ?
print u'\u2500'
File "C:\Python24\lib\encodings\cp1252.py", line 18, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2500'
in position 0: character maps to <undefined> 4 5122
On Mar 4, 12:51 pm, jefm <jef.mangelsch...@gmail.comwrote:
How can I print the unicode box drawing characters in python:
print u'\u2500'
print u'\u2501'
print u'\u2502'
print u'\u2503'
print u'\u2504'
Traceback (most recent call last):
File "\test.py", line 3, in ?
print u'\u2500'
File "C:\Python24\lib\encodings\cp1252.py", line 18, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2500'
in position 0: character maps to <undefined>
Just FYI, not an answer.
It works like a charm on linux (ubuntu, fc3, python 2.4.1 & 2.5.2)
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>print u'\u2500'
©¤
>>print u'\u2501'
©¥
>>print u'\u2502'
©¦
>>print u'\u2503'
©§
>>> print u'\u2504'
©¨
on windows using python 2.4. ???
-N
jefm <je**************@gmail.comwrote:
How can I print the unicode box drawing characters in python:
print u'\u2500'
print u'\u2501'
print u'\u2502'
print u'\u2503'
print u'\u2504'
Traceback (most recent call last):
File "\test.py", line 3, in ?
print u'\u2500'
File "C:\Python24\lib\encodings\cp1252.py", line 18, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2500'
in position 0: character maps to <undefined>
On linux in an utf8 console, it works with 2ython 2.4.4 and 2.5.1. It
looks like your python is using cp 1252 for output. Which does not
contain the box drawing characters. I don't think using a different
encoding would work (e.g. print u'\u2500'.encode('cp437'), or print
u'\u2500'.encode('utf8'))
Marc
on windows using python 2.4. ???
yes, as a matter of fact I am.
Did not feel the need to switch to 2.5 yet.
I'm gonna give this a try, but it requires me to dig up 2.5 versions
of the libraries i am using.
(one of them didn't at the time and that is why I stuck to 2.4)
on windows using python 2.4. ???
I was on Python 2.4.3 and it gave me that problem.
I upgraded to 2.4.4 and it works.
thanks for the tip. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill Eldridge |
last post by:
I'm trying to grab a document off the Web and toss it
into a MySQL database, but I keep running into the
various encoding problems with Unicode (that aren't
a problem for me with GB2312, BIG 5,...
|
by: Peter Wilkinson |
last post by:
Hello tlistmembers,
I am using the encoding function to convert unicode to ascii. At one point
this code was working just fine, however, now it has broken.
I am reading a text file that has is...
|
by: webdev |
last post by:
lo all,
some of the questions i'll ask below have most certainly been discussed
already, i just hope someone's kind enough to answer them again to help
me out..
so i started a python 2.3...
|
by: Neil Schemenauer |
last post by:
python-dev@python.org.]
The PEP has been rewritten based on a suggestion by Guido to change
str() rather than adding a new built-in function. Based on my
testing, I believe the idea is...
|
by: ghostnguyen |
last post by:
Hi all
I read data from a website and encoding in UTF8. So the result I had like
this:
và resumes trực tiế
How can convert the "ự" (and these string like this) to Unicode
character.
|
by: William Cruz |
last post by:
How can I access these unicode symbols & show them thru my application.
Thanks.
http://www.unicode.org/charts/PDF/U2200.pdf
William Cruz
*** Sent via Developersdex...
|
by: ChaosKCW |
last post by:
Hi
I am reading from an oracle database using cx_Oracle. I am writing to a
SQLite database using apsw.
The oracle database is returning utf-8 characters for euopean item
names, ie special...
|
by: John Nagle |
last post by:
Regular expressions are compiled in ASCII mode unless
Unicode mode is specified to "rc.compile". The difference is that regular
expressions in ASCII mode don't recognize things like
Unicode...
|
by: vekipeki |
last post by:
I am having a problem with basic drawing of unicode characters in Windows 2000 and XP.
I have written a simplest possible C# WinForms program to test it (just create a new Windows Forms C#...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |