Typing UTF-8 characters in IDLE #2

  • Permalink
  • submit to reddit
  • Email
  • Follow


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

See related articles to this posting

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
comp.lang.python 71969 articles. 11 followers. Post

1 Replies
54 Views

Similar Articles

[PageSpeed] 49

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Typing UTF-8 characters in IDLE
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... Ricky Waller wrote: > A few unicode tutorials on the web show that it's possible to type > unicode characters into the IDLE gui... &...

UTF-8 garbage characters #2
Pierre Goiffon Oct 6 2004, 4:29 am show options Newsgroups: comp.infosystems.www.authoring.html >> The problem with charset UTF-8 on pages with forms for e.g. >> guestbooks, formmail and bloggs is that writing in a non-english >> language can give garbage characters from the letters that is not> >> represented in the english language. That's because what is writed in >> the text box don't get encoded, as text done with HTML editors does. > >I really can't understand your post. A server that sends a form to a client >with th...

Malformed UTF-8 character #2
I am lost on this one. All I am doing is reading simple text from a file: ... use strict; ... read the following data from a text file: inventory1,07042006,M,ACCOUNTED FOR,255 inventory1,07042006,M,NAME, inventory1,07042006,M,OVER/UNDER,-255 .. .. .. my @dat = split/\,/; push @{ $DATA{ $dat[ 2 ] }{ $dat[ 3 ] }}, $dat[ 4 ] if $dat[ 4 ]; then display it with the following: my $D7 = $screen->Entry( -state => 'normal', -takefocus => 0, -font ...

\bibliographystyle error with UTF-8 character #2
--=-=-= Content-Type: text/plain [re-posting, characters got mangled previously] Hi, With file foo.bib containing the single entry: ---<---------------cut here---------------start-------------->--- --=-=-= Content-Type: text/x-bibtex; charset=utf-8 Content-Disposition: inline; filename=foo.bib Content-Transfer-Encoding: 8bit @ARTICLE{1, author = {Surname1, Ø. and Surname2, A.}, title = {Title X}, journal = {Journal X}, year = {2008}, volume = {1}, pages = {1-2}, number = {1} } --=-=-= Content-Type: text/plain ---<---------------cut here---------------end----...

xterm 2.4.3 fails to displays some of the UTF-8 characters
The important thing with the Exceed emulator is the fonts are loaded from the Exceed Windows client directory and not on the Unix host. My running OS is Solaris 10 over x86. I got 'xterm 2.4.3' from the www.sunfreeware.com web site because the standard xterm delivered with Solaris was not displaying the UTF-8 fonts correctly. So after successfully installing the 'en_GB.UTF-8' locale, I was able to display the extended characters (like Chinese and Arabic characters). Here is my terminal env: XTERM_LOCALE=en_GB.UTF-8 LANG=en_GB.UTF-8 HZ=100 XTERM_VERSION=XTerm(243) OPENWINH...

Re: tsearch2, ispell, utf-8 and german special characters #2
Hi! Okay, I changed locale via initdb and I've got it working to some extent no= w. Now I've got some problem with the ISpell-dictionary and the stopwords-list= .. Both have been compiled with de_DE.utf8-locale. When I=20 SELECT to_tsvector('default_german', 'Jeden Tag wirst Du ein bisschen =E4lter, aber D= u lernst'); I get 'tag':2 'aber':8 'eint':5 'lernen':10 '=E4lter':7 'bisschen':6 I've got three questions regarding this result:=20 1. both 'ein' and 'abe...

Re: [OpenFTS-general] AW: tsearch2, ispell, utf-8 and german special characters #2
Hi! ts2test=3D# select * from ts_debug('Jeden Tag wird man ein bisschen weiser'= ); ts_name | tok_type | description | token | dict_name | tsvect= or=20=20 ----------------+----------+-------------+----------+-------------+--------= ---- default_german | lword | Latin word | Jeden | {de_ispell} |=20 default_german | lword | Latin word | Tag | {de_ispell} | 'tag' default_german | lword | Latin word | wird | {de_ispell} |=20 default_german | lword | Latin word | man | {de_ispell} |=20 default_german | lword | Lat...

how to put 8 "int" => 10100010 into one character of type "char" #2
I try to put 8 int bit for example 10100010 into one character of type char(1 octet) with no hope . Could anyone propose a simple way to do it? Thank you very much. Anna <petitmouton@gmail.com> writes: > I try to put 8 int bit for example 10100010 into one character of type > char(1 octet) with no hope . Could anyone propose a simple way to do > it? Thank you very much. It would help is we saw what you did. I would write: unsigned char c = 0xA2; /* Hex A2 is 1010 0010 */ Not that unsigned char is almost always safer for this sort of thing. -- Ben. On 15 juin, 11:52, B...

=?UTF-8?Q?=E2=9D=80=7E=E2=9D=80Low_Price_Good_Quality_Fashion_Styles_Clothin?= =?UTF-8?Q?g_Brand_T=2Dshirts=2CSuits=2CJackets=2CShirts=2Cetc=2E=2Dwelcome_to_site_w?= =?UTF-8?Q?ww=2Eguomeitrade=2 #2
=E2=9D=80~=E2=9D=80Low Price Good Quality Fashion Styles Clothing Brand T- shirts,Suits,Jackets,Shirts,etc.-welcome to site www.guomeitrade.com Exempt Freight Paypal Payment T-shirts--http://www.guomeitrade.com/category-871-b0-T-Shirt.html Suits -- http://www.guomeitrade.com/category-862-b0-Suit.html Jackets -- http://www.guomeitrade.com/category-822-b0-Jacket.html Shirts -- http://www.guomeitrade.com/category-853-b0-Shirt.html online store www.guomeitrade.com T-shirt http://www.guomeitrade.com/category-871-b0-T-Shirt.html A&F T-Shirt http://www.guomeitrade.com/categor...