|
|
Typing UTF-8 characters in IDLE #2
Ricky,
I found your message now, because I also would encounter the same
problem.
> A few unicode tutorials on the web show that it's possible to type
> unicode characters into the IDLE gui...
>
> However, when i type korean (hangul) characters it complains:
>
> Unsupported Characters in input
>
> I don't have a great understanding of unicode, but when I use a UTF-8
> source file with korean strings in, and run it as a CGI script it
> works fine.
>
> I'm using python 2.3.3 on win XP.
>
> Any tutorials / info anyone could point me to? Thanks...
Now I am using Hangle with Japaese.
What I did is as follow.
My Python is now 2.4.3
1) open the IOBinding.py in $python/idellib
2) see the block just after line35, and insert one line.
----
encoding = "ascii" # line 35
if sys.platform == 'win32':
# On Windows, we could use "mbcs". However, to give the user
# a portable encoding name, we need to find the code page
try:
encoding = locale.getdefaultlocale()[1]
codecs.lookup(encoding)
except LookupError:
pass
encoding = 'utf-8' ## <- this line force the encoding to utf-8.
-----
3) save the file and quit Idle and reopen Idle.
I hope my experience will solve your problem.
(It has passed 2 years and more, so you might already solve the problem.
I you know better solution, please inform me.)
kazuo
|
|
0
|
|
|
|
Reply
|
fujimoto (2)
|
9/30/2006 12:29:20 PM |
|
thanks, it is useful.
but ,why this line "encoding = locale.getdefaultlocale()[1]" in
original file"IOBinding.py " ,
don't work?
it should be work
kazuo fujimoto wrote:
> Ricky,
>
> I found your message now, because I also would encounter the same
> problem.
>
>
> > A few unicode tutorials on the web show that it's possible to type
> > unicode characters into the IDLE gui...
> >
> > However, when i type korean (hangul) characters it complains:
> >
> > Unsupported Characters in input
> >
> > I don't have a great understanding of unicode, but when I use a UTF-8
> > source file with korean strings in, and run it as a CGI script it
> > works fine.
> >
> > I'm using python 2.3.3 on win XP.
> >
> > Any tutorials / info anyone could point me to? Thanks...
>
> Now I am using Hangle with Japaese.
>
> What I did is as follow.
>
> My Python is now 2.4.3
>
> 1) open the IOBinding.py in $python/idellib
> 2) see the block just after line35, and insert one line.
> ----
> encoding = "ascii" # line 35
> if sys.platform == 'win32':
> # On Windows, we could use "mbcs". However, to give the user
> # a portable encoding name, we need to find the code page
> try:
> encoding = locale.getdefaultlocale()[1]
> codecs.lookup(encoding)
> except LookupError:
> pass
> encoding = 'utf-8' ## <- this line force the encoding to utf-8.
> -----
> 3) save the file and quit Idle and reopen Idle.
>
> I hope my experience will solve your problem.
>
> (It has passed 2 years and more, so you might already solve the problem.
> I you know better solution, please inform me.)
>
> kazuo
|
|
0
|
|
|
|
Reply
|
mudengke (1)
|
9/30/2006 7:34:59 PM
|
|
|
1 Replies
26 Views
(page loaded in 0.054 seconds)
|
|
|
|
|
|
|
|
|