473,387 Members | 3,033 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,387 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 13252
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.