encode.convert(options)
The content in this help topic pertains to SuiteScript 2.0.
Method Description |
Converts a string to another type of encoding. |
Returns |
The re-encoded string. |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.1 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The string to encode. |
2015.1 |
|
string |
required |
The encoding used for the input string. Use encode.Encoding to set the value. |
2015.1 |
|
string |
required |
The encoding to apply to the output string. If set to UTF-8 and the input string does not contain a valid UTF-8 encoded string, the operation will continue but the resulting string will contain the replacement character Use encode.Encoding to set the value. |
2015.1 |
Errors
Error Code |
Thrown If |
---|---|
|
The value of the |
|
Any of the |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/encode Module Script Samples.
//Add additional code
...
var hexEncodedString = encode.convert({
string: stringInput,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.HEX
});
...
//Add additional code