[Pythonmac-SIG] Chinese glyphs in Python 3

Ronald Oussoren ronaldoussoren at mac.com
Tue May 26 17:20:16 CEST 2009


I've found the source of this bug: Tcl/Tk's rendering of Unicode data  
is broken on OSX. Luckily this is fixed on Tcl/Tk 8.5, but that  
doesn't help you very much because the Python installers all link to  
the (system install of) Tcl/Tk 8.4 and that version is not binary  
compatible with the later version.

Which brings the question: is there anyone on the list that would like  
to look into providing two copies of Tkinter in the binary installers  
on OSX? This would preferably install both copies of the tkinter  
extension and magicly select the right copy to use at runtime. That  
way Tkinter, and more importantly IDLE, would work out of the box and  
anyone that would need a better version of Tk can use that by  
installing Tk themself.

I don't have time to work on this myself though.

Ronald

On 26 May, 2009, at 8:56, Ronald Oussoren wrote:

> I've filed this as issue 6109 at the python bugtracker (http://bugs.python.org/issue6109 
> ). I haven't uploaded your example file yet, would you mind if I did  
> upload the file to the tracker?
>
> Ronald
>
> On 26 May, 2009, at 2:27, John Newman wrote:
>
>> Sorry, pasting the Chinese text into email wasn't very clever. I've  
>> attached a txt file with the Chinese saved as utf-8.
>>
>> John
>>
>>
>> -----Original Message-----
>> From: Ronald Oussoren [mailto:ronaldoussoren at mac.com]
>> Sent: Mon 5/25/2009 11:30 AM
>> To: John Newman
>> Cc: pythonmac-sig at python.org
>> Subject: Re: [Pythonmac-SIG] Chinese glyphs in Python 3
>>
>>
>> On 25 May, 2009, at 16:36, John Newman wrote:
>>
>>
>>         Ronald
>>
>>         See the attachment, where most of the Chinese glyphs are  
>> correctly displayed, but not all.
>>
>>         When I copy and paste these glyphs from Python 3 to JEdit,  
>> all the glyphs display correctly, so the correct unicode code  
>> points are there underlying the glyphs. I've tried most of the  
>> fonts available to me in the GUI and I still can't get them all to  
>> display properly.
>>
>>
>> Could you post the actual text-file as well?
>>
>> Ronald
>>
>>
>>         John
>>
>>
>>         -----Original Message-----
>>         From: Ronald Oussoren [mailto:ronaldoussoren at mac.com]
>>         Sent: Sun 5/24/2009 11:48 PM
>>         To: John Newman
>>         Cc: pythonmac-sig at python.org
>>         Subject: Re: [Pythonmac-SIG] Chinese glyphs in Python 3
>>
>>         John,
>>
>>         On 25 May, 2009, at 1:34, John Newman wrote:
>>
>>
>>                 Apologies if my question is ridiculously trivial -  
>> I'm not a developer, just a relatively new user of Python 3.0.1 on  
>> Mac OS 10.4.11. and I have only just now joined the list.
>>
>>                 When I read in a Chinese text in the Python 3 IDLE  
>> GUI on Windows XP I see all the Chinese glyphs displayed properly.  
>> On my Mac, about one third of the Chinese characters are not  
>> displayed correctly (just empty or black boxes in place of glyphs).  
>> It doesn't matter whether I save/open texts as utf-8, utf-16, etc.  
>> [The glyphs display fine in TextEdit, JEdit, Word etc.]  And the  
>> same kind of problem occurs when I scroll through the list of font  
>> names in Preferences in IDLE: the names in Chinese glyphs have a  
>> number of white or black boxes instead of the glyphs.
>>
>>                 I just assume that this has something to do with  
>> the locale settings in IDLE? On my machine:
>>
>>                 >>> locale.getpreferredencoding()
>>                 'mac-roman'
>>                 >>> locale.getlocale()
>>                 (None, None)
>>
>>                 In my Windows XP, the locale settings are (English,  
>> '1252') and I presume that this difference is relevant to  
>> understanding the different effects I get opening Chinese texts in  
>> my Windows XP and my Mac. 'mac-roman' would not be my natural  
>> choice of encoding if I am looking at Chinese text! I need an  
>> encoding which can handle the range of glyphs we find in GB 18030,  
>> say.
>>
>>                 Am I being naive in thinking that all I have to do  
>> in Python is somehow change the locale settings in some way which  
>> will display Chnese glyphs?  I'm at a loss to know what I should do  
>> in order to display Chinese glyphs properly on the Mac. I tried  
>> experimenting with "setlocale" but couldn't make progress.
>>
>>                 Any suggestions would be very welcome.
>>
>>
>>
>>         This might be a font issue, although the default font  
>> (Courier) seems to be capable of displaying unicode text and  
>> therefore saving as UTF-8 should work.  Another possible souce for  
>> this problem is the GUI framework used by IDLE.
>>
>>          Could you post an example of a file that shows the problem?
>>
>>         Ronald
>>
>>
>>
>>
>>
>>         <glyphs.jpg>
>>
>>
>>
>>
>>
>> <Chinese.txt>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090526/cfa21c34/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2224 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090526/cfa21c34/attachment.bin>


More information about the Pythonmac-SIG mailing list