Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIScriptableUnicodeConverter

This interface is a Unicode encoder for use by scripts.
继承于: nsISupports 最后修改于Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Implemented by: @mozilla.org/intl/scriptableunicodeconverter. To create an instance, use:

var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
                .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);

Method overview

ACString ConvertFromUnicode(in AString aSrc);
ACString Finish();
AString ConvertToUnicode(in ACString aSrc);
AString convertFromByteArray([const,array,size_is(aCount)] in octet aData, in unsigned long aCount);
void convertToByteArray(in AString aString,[optional] out unsigned long aLen,[array, size_is(aLen),retval] out octet aData);
nsIInputStream convertToInputStream(in AString aString);

Attributes

Attribute Type Description
charset string Current character set. Throws NS_ERROR_UCONV_NOCONV if the requested charset is not supported.

Methods

ConvertFromUnicode()

Converts the data from Unicode to one Charset. Returns the converted string. After converting, Finish should be called and its return value appended to this return value.

ACString ConvertFromUnicode(
  in AString aSrc
);

Finish()

Returns the terminator string. Should be called after ConvertFromUnicode() and appended to that function's return value.

ACString Finish();

ConvertToUnicode()

Converts the data from one Charset to Unicode.

AString ConvertToUnicode(
  in ACString aSrc
);

convertFromByteArray()

Converts an array of bytes to a unicode string.

AString convertFromByteArray(
  [const,array,size_is(aCount)] in octet aData,
  in unsigned long aCount
);

convertToByteArray()

Convert a unicode string to an array of bytes. Finish does not need to be called.

void convertToByteArray(in AString aString,
  out unsigned long aLen, 可选
  [array, size_is(aLen),retval] out octet aData
);

convertToInputStream()

Converts a Unicode string to an input stream. The bytes in the stream are encoded according to the charset attribute. The returned stream is non-blocking.

nsIInputStream convertToInputStream(
  in AString aString
 );
Parameters
Return value

An nsIInputStream that will present the text specified in aString as its data.

            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.
            • aString
              The text to encode to the stream. The text is encoded into the character set specified by the charset attribute.

Examples

See Reading textual data and Writing textual data for examples.

文档标签和贡献者

 此页面的贡献者: ziyunfei
 最后编辑者: ziyunfei,