<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I've filed this as issue 6109 at the python bugtracker (<a href="http://bugs.python.org/issue6109">http://bugs.python.org/issue6109</a>). I haven't uploaded your example file yet, would you mind if I did upload the file to the tracker?<div><br></div><div>Ronald<br><div><br><div><div>On 26 May, 2009, at 2:27, John Newman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div> <!-- Converted from text/plain format --><p><font size="2">Sorry, pasting the Chinese text into email wasn't very clever. I've attached a txt file with the Chinese saved as utf-8.<br> <br> John<br> <br> <br> -----Original Message-----<br> From: Ronald Oussoren [<a href="mailto:ronaldoussoren@mac.com">mailto:ronaldoussoren@mac.com</a>]<br> Sent: Mon 5/25/2009 11:30 AM<br> To: John Newman<br> Cc: <a href="mailto:pythonmac-sig@python.org">pythonmac-sig@python.org</a><br> Subject: Re: [Pythonmac-SIG] Chinese glyphs in Python 3<br> <br> <br> On 25 May, 2009, at 16:36, John Newman wrote:<br> <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ronald<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; See the attachment, where most of the Chinese glyphs are correctly displayed, but not all.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> <br> Could you post the actual text-file as well?<br> <br> Ronald<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; John<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----Original Message-----<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: Ronald Oussoren [<a href="mailto:ronaldoussoren@mac.com">mailto:ronaldoussoren@mac.com</a>]<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent: Sun 5/24/2009 11:48 PM<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: John Newman<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cc: <a href="mailto:pythonmac-sig@python.org">pythonmac-sig@python.org</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: Re: [Pythonmac-SIG] Chinese glyphs in Python 3<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; John,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 25 May, 2009, at 1:34, John Newman wrote:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.]&nbsp; 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.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I just assume that this has something to do with the locale settings in IDLE? On my machine:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; locale.getpreferredencoding()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'mac-roman'<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; locale.getlocale()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (None, None)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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?&nbsp; 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.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Any suggestions would be very welcome.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.&nbsp; Another possible souce for this problem is the GUI framework used by IDLE.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Could you post an example of a file that shows the problem?<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ronald<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;glyphs.jpg&gt;<br> <br> <br> <br> <br> </font> </p> </div> <span>&lt;Chinese.txt&gt;</span></blockquote></div><br></div></div></body></html>