[Users] Jsbuild : how to set default encoding to utf8 ?

Yves Moisan yves.moisan at boreal-is.com
Mon Mar 8 18:14:20 CET 2010


Hi All,

We're using jsbuild on a windows box and the compressed file is saved as 
an ASCII file since this is the default Python char encoding but it 
contains non ascii characters (e.g. OpenLayers Spanish language file).  
The compressed file works well in most browsers, but it will crash IE6.  
One way around this is to open the compressed file in an editor like 
Notepad++ and convert it to UTF-8 without BOM.  That way IE6 is happy.

To save the file as UTF-8 without BOM from a script, I was thinking of 
switching Python's default encoding from ASCII to UTF8 [e.g. 
sys.setdefaultencoding('utf-8')].  I've tried shoving that line into 
jsbuild-script.py and  Python raises an error.  I found out that the 
interpreter has to be loaded with the -S flag so that the 
setdefaultencoding is still defined in the sys module (otherwise the 
setdefaultencoding is removed from the sys module namespace; see 
http://blog.ianbicking.org/illusive-setdefaultencoding.html). 

I was wondering how make JSbuild's default encoding other than ASCII.  I 
changed site.py's default encoding to utf-8 and I still get garbled 
chars, so there obviously isn't any char encoding conversion done by 
just setting the default encoding to utf-8.  Or do people convert the 
file to UTF-8 after it is generated with some .bat script ?

TIA,

Yves


More information about the Users mailing list