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
fujimoto (2)
9/30/2006 12:29:20 PM
comp.lang.python 74791 articles. 15 followers. Post Follow

1 Replies
134 Views

Similar Articles

[PageSpeed] 41
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
mudengke (1)
9/30/2006 7:34:59 PM
Reply:
Similar Artilces:

83% of companies surveyed plan to move to Win7 within 2-3 years
"Most companies do, however, see themselves adopting Windows 7 in the long run. Though just 17 per cent plan on updating in the next 12 months, 42 per cent believe that they will be running Windows 7 within 12-24 months, and an additional 24 per cent plan on updating within the next 24-36 months." http://www.itnews.com.au/News/100869,study-predicts-bear-market-for-windows-7.aspx Linux won. Microsoft is doomed. DFS wrote: > "Most companies do, however, see themselves adopting Windows 7 > in the long run. Though just 17 per cent plan on updating in > the next 1...

why (1, 2, 3) > [1, 2, 3] is true?
I tired to google for comparison of tuple to list but i failed. Could anyone explain it to me? Best regards, fat bold cyclop fat bold cyclop, 25.02.2010 14:00: > I tired to google for comparison of tuple to list but i failed. > > Could anyone explain it to me? Both are not equal, so the comparison returns an arbitrary result in Py2. Note that this was fixed in Py3: Python 3.1.1+ (r311:74480, Nov 2 2009, 15:45:00) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> (1,2,3) > [1,2,3]...

WebSphere Development Studio Client for iSeries ver 5.1.2 Problem #2
hi, I'm a newbie in the Websphere world. I'am using: WebSphere Development Studio Client for iSeries ver 5.1.2 OS/400 V5R2M0 WebSphere 5.1 Test Environment I have a DDS file: ..=2E. ..=2E. A R ECRAN00 A 13 PAGEUP A 14 PAGEDOWN A CLRL(*NO) A NUMERO 6Y 0B 6 21EDTCDE(Z) A 12 DSPATR(PC) A 12 DSPATR(RI) ..=2E. ..=2E. A R ECRAN01 ..=2E. ..=2E. A ...

US-MD-Rockville: Peoplesoft Developer, PS 8.0 Time & Labor, Payroll, Ben. Admin; (45337814405)
US-MD-Rockville: Peoplesoft Developer, PS 8.0 Time & Labor, Payroll, Ben. Admin; (45337814405) ============================================================================================== Position: Peoplesoft Developer Reference: SMC01877 Location: Rockville MD Duration: 7M Skills: PeopleSoft 8.0 Time and Labor, Payroll, and Ben Admin technical experience. Scope: This is a peoplesoft developer position. This position is an immediate need. There is a chance for this position to become long term. The request is urgen...

Discovering FS type
Is there any way to discover the filesystems which are on partitions which OS/2 does not recognise? On Thu, 16 Dec 2004 19:18:45 UTC, jp <tester@nospam.microrev.net> wrote: > Is there any way to discover the filesystems which are on partitions > which OS/2 does not recognise? Do you mean using a programming interface (API) or using another program to do it ? If the latter, the DFSee program will identify a few more filesystems than OS/2 normally does, like NTFS, EXT2/3 and ReiserFS. It also display the most-likely usage of partition-types that are non-standard f...

Re: I-D ACTION:draft-ietf-dnsext-rfc2672bis-dname-05.txt #2
What "old resolvers" are we protecting by forcing the TTL to 0 rather than having the TTL match the DNAME's TTL? Additionally this is inconsistant with the rest of the draft. A CNAME RR record, with TTL matching that of the DNAME, is synthesized for old resolvers, specifically for the QNAME in the query. Mark On the server side, the DNAME RR record is always included in the answer section of a query. A CNAME RR record with TTL 0 is synthesized for old resolvers, specifically for the QNAME in the query. DNSSEC [RFC4033], [RFC4034], [RFC40...

Help with NAT #2
Dear Guru, I have an IIS server that I would like to put behind a linux firewall but I cannot seem to get this to work. In an attempt to simply get this to work, I have downloaded and installed Webmin so any help with it or the real config files will work. I have already used squid to do port accel(reverse proxy) but unfortunaltly it seems squid will not forward SSL encrypted requests so I am trying to use NAT to forward port 443 requests to the appropriate internal server. I know I need to have IP_Forwarding turned on but am not sure how to configure the routing table. I have a NAT rule ...

(",) Do You Want To Know For Sure You Are Going To Heaven? #3 #2
http://www.want-to-be-sure.blogspot.com << Click On Link ...

What type VPN do you recommend
I would like to connect my home office to my central office. The secure is most important for me. I would like to use VPN router and connection via Internet. What kind of VERY SECURE router with VPN do you recommend for me?? Robert www.snapgear.com ...

PSP-8 | Clearly, Not Popular
Just got back from a LARGE bookstore. I found, 2, yes, that's right, TWO Paint Shop Pro 8 books. However, I found 75 Photoshop books!!!!! :-) So, go ahead, tell me again, just how popular Paint Shop Pro is. :-) Uni p.s. Actually, there were more books available for Paint Shop Pro 7! Was that a used book store? I've seen even more PS books there! HA Me thinks ppl gave up on it easily -- Cheers, - T a n y a "Uni" <no.email@no.email.invalid> wrote in message news:4154D81C.7040005@no.email.invalid... > Just got back from a LARGE bookstore. I found, 2, yes, t...

Re: [OT] disk drive spin direction #2
> Which way does a disk drive spin? I vaguely remember hearing something > about it spinning IN to the heads, unlike a stereo turntable. Do I > recall right? > > Can anyone here answer this authoritatively? And also answer Why? if it > spins IN to the heads. > > Thanks. If the drive spins CCW you can make it spin CW by placing it upside down. John "REBOOT" Brandon VMS Systems Administrator firstname.lastname.spam.me.not@dalsemi.com On Fri, 21 Jan 2005 11:02:25 -0600, John Brandon <brandon@dalsemi.com> wrote: >> Which way does a disk drive...

Re: Create a Household ID #2
Here is an implementation: data Given; length Relation $ 20; input Subject Object Relation; datalines; 1 2 spouseandpartner 2 1 spouseandpartner 1 3 parent 3 1 child 2 3 parent 3 2 child 4 5 spouseandpartner 5 4 spouseandpartner 6 7 parent 7 6 child 8 9 spouseandpartner 9 8 spouseandpartner ; data Household; retain ID 0 partner1 partner2; set Given; if Relation eq "spouseandpartner" then do; if partner1 ne Subject and partner2 ne Subject and partner1 ne Object and partner2 ne Object then do; ID+1; partner1=Subject; partner2=Object; ...

Struve functions #2
Hello. $VersionNumber 5.2 Consider the indefinite integral of the functions StruveH[n, x] and StruveL[n, x] strs = HoldForm[Integrate[{StruveH[n, x], StruveL[n, x]}, x]] ReleaseHold@strs {Integrate[StruveH[n, x], x], Integrate[StruveL[n, x], x]} It seems that Mathematica can't get the antiderivative of these functions. However, strs /. Integrate[f_, o_] :> Integrate[f, {o, 0, t}, Assumptions -> n > -2]// ReleaseHold//FunctionExpand {(t^(2 + n)*HypergeometricPFQ[{1, 1 + n/2}, {3/2, 2 + n/2, 3/2 + n}, - (t^2/4)])/(2^n*((2 + n)*Sqrt[Pi]*Gamma[3/...

Bind 9.2.4 slaving problem [bind 9.2.1 and bind 8.3.3]
Greetings. I have a master name server running BIND 9.2.1 [Debian Woody - server not available on the Internet] and a slave server running bind 9.2.4 [Debian Sarge - not currently available on the Internet] and two others running bind 8.3.3 [Debian Woody - on the Internet]. The 9.2.1 is a master for all the others to slave from. I have an entry in a zone defined on the master as the following: > $ORIGIN example.com. > spamhaus-datafeed IN NS local-rbl-a > spamhaus-datafeed IN NS local-rbl-b When I issue the following command: #> host -t nx spam...

First 8 MB Error on 10.3
Hi, I have an Imac Rev a 233 Mhz that I am trying to upgrade to os 10.3.9 I have followed the instruction on various forums on how to do this. I now have 256MB RAM in top slot and 32 MB in bottom slot and the standard 2 MB Video RAM I downloaded the v1.2 patch from apple to upgrade to os 10.3 I boot from the 10.3 cd ok but cant get past the hard drive testing stage of the install. I have tried 1 or 2 partitions and another hard drive as well as making sure the hard drive is fully erased, before I install. I have also tried upgrading from 9.2.2 .... But the problem is always the same T...

Thermal flow toolbox? #2
Hello, As a newbie to Matlab, but not to electronics, I was thinking to design a heat transfer analysis toolbox for electronics (ASIC/MCM/PCB). I am quite familiar to the methodology as such, only not to Matlab. The question that arise is of course: Has this alrady been done? I know there are commercial packages like FLOTHERM and alike, but I have not been able to trace any decent freeware packages out there. Anyone else that have seen anything? This is my second (identical) post. If I still do not get any reply I will get the message, don't worry! :-) /Lars ...

Canon i990 #2
I can't comment on the i965 having never used one, but having owned an i990 now for only a couple of days, I can say that it is just astonishing in terms of quality and speed. The prints this thing produces are utterly indistinguishable from photographs. The dot pitch is comparable to photo grain when viewed through a 10 x loupe and the colour and detail are simply breathtaking. Having got used to a three year old HP, I was reduced to fits of laughter watching the printer at work. Whereas a max quality print on the HP would take several minutes, the Canon will spit out a border...

Oracle 9.2.0.1.0 Install Fail On Win2k
I am attempting to install Oracle 9i (9.2.0.1.0) onto my machine running Windows 2000 Professional which, according to Oracle, is a supported configuration. After selecting my installation type, the installer fails with the following error message: "The procedure entry point SetHandleContext could not be located in the dynamic link library KERNEL32.DLL". From searching the web, I have found comments suggesting that SetHandleContext no longer exists in KERNEL32.DLL on Windows 2000. Is the 9i installer perhaps thinking that I am running NT ? Help in this regard would be greatly app...

Type A ,Type B
Hi, Someone please differentiate Type A and Type B messages/network? or give me poitners to where i can find them.. Thanks, ...Vinodh.. In article <1129109340.812999.298990@f14g2000cwb.googlegroups.com>, "Vinodh Saigopal" <vinodh.sai@gmail.com> wrote: > Hi, > > Someone please differentiate Type A and Type B messages/network? > or give me poitners to where i can find them.. What protocol are you talking about? There's no such terms, AFAIK, in IP, TCP, UDP, or ICMP. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PL...

[ANN] Ruby/ZOOM 0.2.1
Hi, I am happy to announce the 0.2.1 release of Ruby/ZOOM. Ruby/ZOOM provides a Ruby binding to the Z39.50 Object-Orientation Model (ZOOM), an abstract object-oriented programming interface to a subset of the services specified by the Z39.50 standard, also known as the international standard ISO 23950. You can get more information from the home page: http://ruby-zoom.rubyforge.org This release fixes a possible crasher when rubyfying the case of options names, discovered and fixed by Pascal Terjan. Enjoy Laurent ...

Re: mixed models comparison #2
depuy001@NOTES.DUKE.EDU sagely replied: ><P>Unless there's something I'm missing that's special about a mixed model >= >as opposed to a normal regression . . . .</P><P>you run the two models, >loo= >k at the -2lnL &nbsp;(-2 log likelihood) numbers for Intercept with >Covaria= >tes. &nbsp;The difference between the two numbers is distributed as a >chi-s= >quare variable, with degrees of freedom equal to the difference in the >numb= >er of variables between the two models . . . then look to see if that >numbe= >r is sig...

Download any solution manual or test bank #8
! ! ! TEST BANKS, SOLUTION MANUALS, INSTRUCTOR MANUALS, CASE SOLUTIONS, POW= ER POINT SLIDES ! ! ! Hello Everybody, To get the Solution manuals and Test banks just email me with your book det= ails. My e-mail address is: mysmandtb@xxxxxxxxx, mysmandtb(at)gmail(dot)com. Plea= se replace (at) by @ and (dot) by .=20 If you need Test banks and Solution manuals, email to me.=20 http://instructortestsolution.blogspot.com/ http://www.mysmandtb.blogspot.com/ Reply time: Within 6 hours, If online, immediately!!!! Delivery time: Within 12- 24 hours. If online, immediately after paymen...

[ANN] earworm 0.0.2 Released
earworm version 0.0.2 has been released! * <http://earworm.rubyforge.org> Earworm can identify unknown music using MusicDNS and libofa. ## FEATURES/PROBLEMS: * Identifies mp3, ogg, and wav files. ## SYNOPSIS: Identify an unknown audio file: ew = Earworm::Client.new('MY Music DNS Key') info = ew.identify(:file => '/home/aaron/unknown.wav') puts "#{info.artist_name} - #{info.title}" Changes: ### 0.0.2 * 2 Bugfixes * Oop! Forgot a require. Thanks Mike McKay! * Added better error messaging. Thanks again to Mike McKay. * <http://earworm...

Cannot type []@{} etc. on German keyboard :-(
Hello, I have a German keyboard and use both XP Home and XP Pro which are installed on the same PC. Now the weird thing: On the XP Home machine I have no problems typing []@{} etc. Note that you need to press AltGr on a German keyboard to type them. On the XP Pro machine none of this keys get displayed. I either get nothing or an red rectangle is displayed instead of the key. This is the case although I use the same installed Matlab which I have installed only once (6.5.1) I have tried everything: Changing language from German to US English, changing location settings in the Control Panel...

Conditional for...in failing with utf-8, Spanish book translation
Hi all, This is my first Usenet post! I've run into a wall with my first Python program. I'm writing some simple code to take a text file that's utf-8 and in Spanish and to use online translation tools to convert it, word-by-word, into English. Then I'm generating a PDF with both of the languages. Most of this is working great, but I get intermittent errors of the form: --- Translating coche(coche)... Already cached! English: car Translating ahora(ahora)... tw returned now English: now Translating mismo?(mismo)... Already cached! English: same Translating ¡A(�...