nsIUTF8ConverterService

IID:249f52a3-2599-4b00-ba40-0481364831a2
Inherits From:nsISupports

This interface is intended to be used as a service.

This interface is implemented by the following components:


Methods

AUTF8String convertStringToUTF8 ( ACString string , char* charset , PRBool skipCheck ) AUTF8String convertURISpecToUTF8 ( ACString spec , char* charset )

AUTF8String convertStringToUTF8 ( ACString string , char* charset , PRBool skipCheck )

Ensure that string is encoded in UTF-8. If not, convert to UTF-8 assuming it's encoded in charset and return the converted string in UTF-8.

Arguments:
string: a string to ensure its UTF8ness
charset: the charset to convert from if |string| is not in UTF-8
skipCheck: determines whether or not to skip 'ASCIIness' and 'UTF8ness' check. Set this to PR_TRUE only if you suspect that string can be mistaken for ASCII / UTF-8 but is actually NOT in ASCII / UTF-8 so that string has to go through the conversion. skipping ASCIIness/UTF8ness check. The most common case is the input is in 7bit non-ASCII charsets like ISO-2022-JP, HZ or UTF-7 (in its original form or a modified form used in IMAP folder names).
Returns:
the converted string in UTF-8.

AUTF8String convertURISpecToUTF8 ( ACString spec , char* charset )

Ensure that spec (after URL-unescaping it) is encoded in UTF-8. If not, convert it to UTF-8, assuming it's encoded in charset, and return the result.

Make sure that all characters outside US-ASCII in your input spec are url-escaped if your spec is not in UTF-8 (before url-escaping) because the presence of non-ASCII characters is blindly regarded as an indication that your input spec is in unescaped UTF-8 and it will be returned without further processing. No valid spec going around in Mozilla code would break this assumption.

XXX The above may change in the future depending on the usage pattern.

Arguments:
spec: an url-escaped URI spec to ensure its UTF8ness
charset: the charset to convert from if |spec| is not in UTF-8
Returns:
the converted spec in UTF-8.

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com