# unichar2oct

This function converts an universal charstring value to an octetstring value. The first parameter is the universal characters to be encoded into octets. The second parameter is the type of the string encoding. The allowed values for string encoding are: UTF-8, UTF-8 BOM, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE. If the second parameter is omitted the default encoding is UTF-8 (without the BOM). unichar2oct appends the Byte Order Mark (BOM) to the beginning of the returned octetstring, except for UTF-8 encoding. (In case of UTF-8, use UTF-8 BOM encoding to add the BOM.) The function remove_bom can be used to remove the BOM, if it is not needed.

Related keyword:

- octetstring
- universal
- charstring
- remove_bom

### unichar2oct(universal charstring [,charstring]) return octetstring

Example 1:

const universal charstring c_ustr := "ÃÃÃÃ¤Ã¶Ã¼";

const octetstring c_result := unichar2oct(c_ustr, "UTF-16LE");

The constant called c_result will conatin the characters 'FFFE00C400D600DC00E400F600FC'O;