By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

Typing UTF-8 characters in IDLE

P: n/a
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

Sep 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Sep 30 '06 #2

P: n/a
----
# I replied to this message by 'Reply' function of my mailer. So this
message was not sent to python - list, so I put it again to the
python-list.
#
-----
Thank you for your reply.

On 30 Sep 2006 12:34:59 -0700
"mu******@gmail.com" <mu******@gmail.comwrote:
thanks, it is useful.

but ,why this line "encoding = locale.getdefaultlocale()[1]" in
original file"IOBinding.py " ,
don't work?
If my windows set "endoding" to utf-8 here, it will work for my
puropose.

But windows only can set encoding to default setting of my Local, for me
it is cp932, Japanese. So if I input Hnagul here,

"Unsupported Characters in input" error will arise.

So I am expecting that Idle will have a settings in its configration to
encoding to UTF-8 , inspite of locale.getdefaultlocale()[1].

Ofcourse it is not good for winodws95/98 users, but very useful for
Windows XP users.
it should be work
reagrds.

kazuo
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

--
http://mail.python.org/mailman/listinfo/python-list
---------------------------------------------------
kazuo fujimoto <fujimoto at sakushin-u.ac.jp>
Sakushin Gakuin University, Faculty Human & Culture
http://www.sakushin-u.ac.jp/~fujimoto
PGP:D664 D542 D578 5B39 BB2E 50AA 6FEC 2FE7
----------------------------------------------------

Oct 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.