nsISupports
Last changed in Gecko 1.7 AUTF8String convertStringToUTF8(in ACString aString, in string aCharset, in boolean aSkipCheck); |
AUTF8String convertURISpecToUTF8(in ACString aSpec, in string aCharset); |
Ensure that aString
is encoded in UTF-8. If not, convert to UTF-8 assuming it's encoded in aCharset
and return the converted string in UTF-8.
AUTF8String convertStringToUTF8( in ACString aString, in string aCharset, in boolean aSkipCheck, in boolean aAllowSubstitution );
aString
aCharset
aString
is not in UTF-8.aSkipCheck
aString
can be mistaken for ASCII / UTF-8 but is actually not in ASCII / UTF-8 so that aString
has to go through the conversion. Skipping ASCIIness/UTF8ness check. The most common case is the input is in 7bit non-ASCII character sets like ISO-2022-JP, HZ or UTF-7 (in its original form or a modified form used in IMAP folder names).aAllowSubstitution
The converted string in UTF-8.
NS_ERROR_UCONV_NOCONV
aCharset
or error code of nsIUnicodeDecoder
in case of conversion failure.Ensure that aSpec
(after URL-unescaping it) is encoded in UTF-8. If not, convert it to UTF-8, assuming it's encoded in aCharset
, 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.
AUTF8String convertURISpecToUTF8( in ACString aSpec, in string aCharset );
aSpec
aCharset
aSpec
is not in UTF-8.The converted spec in UTF-8.
NS_ERROR_UCONV_NOCONV
aCharset
or error code of nsIUnicodeDecoder
in case of conversion failure.