B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
  * @param strContent
  *        Decoded string content.
  * @param charset
  *        Charset for encode.
  *
  * @return An encoded UInt8Array of string content.
  */
@param strContent
Decoded string content.
@param charset
Charset for encode.

@return An encoded UInt8Array of string content.
@param strContent Decoded string content . @param charset Charset for encode . @return An encoded UInt8Array of string content .
function encodeStringContent(strContent, charset) {
    let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
               .createInstance(Ci.nsIScriptableUnicodeConverter);
    let entry;
    if (charset) {
      entry = WSP_WELL_KNOWN_CHARSETS[charset];
    }
    conv.charset = (entry && entry.converter) || "UTF-8";
    try {
      return conv.convertToByteArray(strContent);
    } catch (e) {
    }
    return null;
  }
function encodeStringContent ( strContent , charset ) { let conv = Cc [ "@mozilla.org/intl/scriptableunicodeconverter" ] . createInstance ( Ci . nsIScriptableUnicodeConverter ) ; let entry ; if ( charset ) { entry = WSP_WELL_KNOWN_CHARSETS [ charset ] ; } conv . charset = ( entry && entry . converter ) || "UTF-8" ; try { return conv . convertToByteArray ( strContent ) ; } catch ( e ) { } return null ; }
@param strContent
        Decoded string content.
@param strContent Decoded string content .
// Set converter to default one if (entry && entry.converter) is null. // @see OMA-TS-MMS-CONF-V1_3-20050526-D 7.1.9