Thanks for the quick reply, Christian.  Very helpful.

On Jan 18, 2005, at 6:32 PM, Christian Biesinger wrote:

there are functions to convert between UTF-8 and UTF-16... NS_CStringToUTF16.

Ahh, thanks. All I saw was NS_ConvertUTF8toUTF16() in nsString.h. The "Mozilla String Guide" does not reference the functions in nsStringAPI.h. I suppose I need to do a better job of grep-ing the include directory of the SDK.

Anything that's two-byte is UTF-16 in Mozilla. This means all AString and all wstring and all PRUnichar* is in UTF-16.

Thanks. I suppose I should know that from the above-mentioned String guide.

Yeah, that kinda sucks. Can you file bugs on functions that don't make it clear which charset a ACString is in?

When I come across them, I will. I don't remember off-hand where I've run into confusion

Hm? Does nsIIOService not suffice to create an nsIURI from an UTF-8 string?

Ahh, wasn't aware of that. I was looking at NS_NewURI(). To be honest, a function that created it from a UTF-16 string would be better, but I can just do the conversion myself :) This is actually better than doing the string conversion/comparison myself, as when the URI is built, it appears to replace 'space' with %20 so my comparison was failing (I was using system libraries on mac to convert from UTF-8 to UTF-16 and then compare. Of course I'd rather use the platform-independent solution).


Thanks again for the reply. I guess I've just been looking in the wrong places.

J

_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to