This interface is intended to be used as a service.
This interface is implemented by the following components:
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.
- 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).
- the converted string in UTF-8.
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.
- spec: an url-escaped URI spec to ensure its UTF8ness
- charset: the charset to convert from if |spec| is not in UTF-8
- the converted spec in UTF-8.
Reference documentation is generated from Mozilla's source.