473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Typing UTF-8 characters in IDLE

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
2 13245
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
----
# 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: dterrors | last post by:
Will php 6 do strong typing and/or namespaces? I was shocked to find out today that there are some people who actually argue that weak typing is somehow better. I didn't even know there was a...
12
by: Michael Muller | last post by:
Is there currently any plan to introduce static typing in any future version of Python? (I'm not entirely sure that "static typing" is the right term: what I'm talking about is the declaration of...
12
by: Jason Tesser | last post by:
I work for at a college where I am one of 2 full-time developers and we are looking to program a new software package fro the campus. This is a huge project as it will include everything from...
15
by: Premshree Pillai | last post by:
How do I force static typing in Python? -Premshree Pillai ===== -Premshree http://www.qiksearch.com/] ________________________________________________________________________ Yahoo! India...
94
by: Gabriel Zachmann | last post by:
Is it correct to say that strong/weak typing does not make a difference if one does not use any pointers (or adress-taking operator)? More concretely, I am thinking particularly of Python vs C++....
49
by: bearophileHUGS | last post by:
Adding Optional Static Typing to Python looks like a quite complex thing, but useful too: http://www.artima.com/weblogs/viewpost.jsp?thread=85551 I have just a couple of notes: Boo...
38
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I...
7
by: Jimmy Shaw | last post by:
Hi everybody, Is there any SIMPLE way to convert from UTF-16 to UTF-32? I may be mixed up, but is it possible that all UTF-16 "code points" that are 16 bits long appear just the same in UTF-32,...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
8
by: Siegfried Heintze | last post by:
The following perl program works when I run it from urxvt-X console on cygwin-x windows LC_CTYPE=en_US.UTF-8 urxvt-X.exe& perl -wle "binmode STDOUT, q; print chr() for 0x410 .. 0x430;" This...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
0
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.