[Project_owners] Open unicode files with jslib ?

David Perry d.perry at utoronto.ca
Fri Nov 7 12:18:28 EST 2003


Erwan Loisant wrote:
> I am playing with jslib file.js module, and I want to read an UTF8 file. 
> It contains both Japanese and French, so unicode is mandatory.
> 
> When I simply open this text file in Firebird (just entering location in 
> location bar) it is correctly displayed. However, when I load it using f 
> = new File(); and read it, Japanese character and French special accents 
> are broken. It seems like jslib read it as a western europe encoded file.

I had a similar problem with TagZilla.  After a lot of research, I 
finally found something that seemed to do the trick in ChatZilla.  Based 
heavily on that, I made a mini-class that'll convert from disk format to 
unicode and back again.  Check out

http://www.mozdev.org/source/browse/tagzilla/src/tagzilla/content/utility.js?rev=1.20&content-type=text/x-cvsweb-markup

The object is at the bottom.  It *seems* to work for me, but I haven't 
given it a whole lot of testing (just some Japanese characters, no French).

ChatZilla is full of goodies.  I thank Rob Ginda and his helper elves 
for a program that's so useful, both in itself and as a study in Mozilla 
programming.

HTH.  HAND.

David



More information about the Project_owners mailing list