With the assistance of this group I am understanding unicode encoding issues much better; especially when handling special characters that are outside of the ASCII range. I've got my application working perfectly now :-)<div>
<br></div><div>However, I am still confused as to why I can only use one specific encoding.<div><br></div><div>I've done some research and it appears that I should be able to use any of the following codecs with codepoints '\xfc' (chr(252)) '\xfd' (chr(253)) and '\xfe' (chr(254)) :</div>
<div><br></div><div>ISO-8859-1   [ note that I'm using this codec on my Linux box ]</div><div>cp1252</div><div>cp437</div><div>latin1</div><div>utf-8</div><div><br></div><div>If I'm not mistaken, all of these codecs can handle the complete 8bit character set.</div>
<div><br></div><div>However, on Windows 7, I am only able to use 'cp437' to display (print) data with those characters in Python. If I use any other encoding, Windows laughs at me with this error message:</div><div>
<br></div><div><div>  File "C:\Python33\lib\encodings\cp437.py", line 19, in encode</div><div>    return codecs.charmap_encode(input,self.errors,encoding_map)[0]</div><div>UnicodeEncodeError: 'charmap' codec can't encode character '\xfd' in position 3: character maps to <undefined></div>
</div><div><br></div><div>Furthermore I get this from IDLE:</div><div><br></div><div><div>>>> import locale</div><div>>>> locale.getdefaultlocale()</div><div>('en_US', 'cp1252')</div></div>
<div><br></div><div>I also get 'cp1252' when running the same script from a Windows command prompt.</div><div><br></div><div>So there is a contradiction between the error message and the default encoding.</div><div>
<br></div><div>Why am I restricted from using just that one codec? Is this a Windows or Python restriction? Please enlighten me.</div></div><div><br></div><div>Dan</div>