[Project_owners] Reading and writing arbitrary unicode strings to file

WC Leung lwchk2001 at yahoo.com.hk
Mon Aug 22 19:22:38 EDT 2005


Jamie Bliss wrote:
> On 8/19/05, Carl <carlpny at yahoo.com> wrote:
> 
>>Hi everyone,
>>
>>I'm afraid my knowledge of unicode is lax.
> 
> 
> Me, too. Any layman's tutorials on it?

Try www.unicode.org . I think it has everything you need.
> 
> 
>>My extension loads arbitrary websites using
>>XMLHttpRequest's responseText.  It then saves the
>>source to a file and opens it later.  The problem is
>>that the stream.write() function doesn't correctly
>>save unicode characters.
> 
> 
> I would think that XMLHttpRequest would convert character set X to
> Unicode (whatever used internally by the JS engine). Saving files as
> ASCII is pretty standard, to my knowledge.
> 
It is not simple simply because they are not converted to Unicode!
BTW, read QuickNote's source for some example.

> 
>>This website doesn't seem to give me a convenient
>>solution:
>>http://developer.mozilla.org/en/docs/Writing_textual_data#Converting_a_string_into_a_stream
>>
>>It seems to say that there is no way whatsoever to
>>read UTF-16 and UTF-32 files in the current release of
>>Firefox.
>>
>>Can't an arbitrary website be encoded using any of
>>UTF-8, UTF-16, or UTF-32?  If so, how can I figure out
>>what the encoding is?  I could just go through the
>>entire string and replace all unicode character with
>>\u#### but this needs to be an efficient function
>>since it is called all the time in my extension.
>>
>>Any recommended ways to save and load arbitrary
>>unicode strings?
> 
> 
> RDF?

Try reading the source code of QuickNote.


More information about the Project_owners mailing list