Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsUTF8ConverterService Class Reference

#include <nsUTF8ConverterService.h>

Inheritance diagram for nsUTF8ConverterService:
Inheritance graph
[legend]
Collaboration diagram for nsUTF8ConverterService:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsUTF8ConverterService ()
virtual ~nsUTF8ConverterService ()
AUTF8String convertStringToUTF8 (in ACString aString, in string aCharset, in boolean aSkipCheck)
 Ensure that |aString| is encoded in UTF-8.
AUTF8String convertURISpecToUTF8 (in ACString aSpec, in string aCharset)
 Ensure that |aSpec| (after URL-unescaping it) is encoded in UTF-8.

Detailed Description

Definition at line 44 of file nsUTF8ConverterService.h.


Constructor & Destructor Documentation

Definition at line 49 of file nsUTF8ConverterService.h.

{};
virtual nsUTF8ConverterService::~nsUTF8ConverterService ( ) [inline, virtual]

Definition at line 50 of file nsUTF8ConverterService.h.

{};

Member Function Documentation

AUTF8String nsIUTF8ConverterService::convertStringToUTF8 ( in ACString  aString,
in string  aCharset,
in boolean  aSkipCheck 
) [inherited]

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.

Parameters:
aStringa string to ensure its UTF8ness
aCharsetthe charset to convert from if |aString| is not in UTF-8
aSkipCheckdetermines whether or not to skip 'ASCIIness' and 'UTF8ness' check. Set this to PR_TRUE only if you suspect that 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 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.
Exceptions:
NS_ERROR_UCONV_NOCONVwhen there is no decoder for aCharset or error code of nsIUnicodeDecoder in case of conversion failure
AUTF8String nsIUTF8ConverterService::convertURISpecToUTF8 ( in ACString  aSpec,
in string  aCharset 
) [inherited]

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.

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

Parameters:
aSpecan url-escaped URI spec to ensure its UTF8ness
aCharsetthe charset to convert from if |aSpec| is not in UTF-8
Returns:
the converted spec in UTF-8.
Exceptions:
NS_ERROR_UCONV_NOCONVwhen there is no decoder for aCharset or error code of nsIUnicodeDecoder in case of conversion failure

The documentation for this class was generated from the following file: