google-code-export / ulipad

Automatically exported from code.google.com/p/ulipad
0 stars 0 forks source link

UliPad causes an error when executing a simple unicode print #243

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. print u"本"
2. Execute with the arrow in ulipad.

What is the expected output? What do you see instead?
I expect to see the kanji, instead I get this error:
> "/usr/bin/python" -u "<some_filename>" 
Traceback (most recent call last):
  File "<some_filename>", line 1, in <module>
    print u"本"
UnicodeEncodeError: 'ascii' codec can't encode character u'\u672c' in 
position 0: ordinal not in range(128)

What version of the product are you using? On what operating system?
UliPad 4.1 in Fedora 13

It works if I use print "本" instead, which is weird :S
UliPad is a fantastic program, thanks a lot for making it! This is just a 
minor bug so you don't need to fix it.

Original issue reported on code.google.com by dura...@gmail.com on 16 May 2010 at 11:21

GoogleCodeExporter commented 9 years ago
because u"本" is not a correct chinese unicode, you can print it and see:

print repr(u"本")

The correct way to create an unicode string in shell, you should do:

unicode("本", 'gbk')

Original comment by limo...@gmail.com on 16 May 2010 at 11:44

GoogleCodeExporter commented 9 years ago
Oh ok. Sorry, I'm still new to unicode! Thanks.

Original comment by dura...@gmail.com on 17 May 2010 at 12:49