<!--/*SC*/DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"/*EC*/-->
<html><head><title></title><style type="text/css"><!--body{padding:1ex;margin:0px;font-family:sans-serif;font-size:small;}a[href]{color:-moz-hyperlinktext !important;text-decoration:-moz-anchor-decoration;}blockquote{margin:0;border-left:2px solid #144fae;padding-left:1em;}blockquote blockquote{border-color:#006312;}blockquote blockquote blockquote{border-color:#540000;}--></style></head><body><div style="font-family: Arial; font-size: medium;" dir="ltr"><div>Is there a way to detect an environment's "default" encoding type under Windows? I'm not sure if code page and encoding mean the same thing here.</div>
<div> </div>
<div>For example: When I use Word on my US based version of Windows and decide to save a file as text, I am prompted with an encoding dialog that defaults to 'Windows (default)' which appears maps to their 'Western European (Windows)' code page which I assume maps to code page 1252. (That's a lot of assumptions!).</div>
<div> </div>
<div>I would like to be able to make the same assumption about text files produced on a user's system. (Of course our software will offer a way to explictly specify an encoding format as well).</div>
<div> </div>
<div>Here's what I've been able to dig up so far but I'm not sure how reliable this is or if its the same information Word is looking at when it offers a default encoding value.</div>
<div> </div>
<div>>>> import locale</div>
<div>>>> locale.getdefaultlocale()[1]</div>
<div>'cp1252'</div>
<div> </div>
<div>Any ideas?</div>
<div> </div>
<div>Malcolm</div></div></body></html>