unicode box drawing

Nanjundi nanjundi at gmail.com
Tue Mar 4 13:41:53 EST 2008


On Mar 4, 12:51 pm, jefm <jef.mangelsch... at gmail.com> wrote:
> 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



More information about the Python-list mailing list