Converts the specified string into a valid string constant of JavaScript. In particular, this includes:
  1. Encoding of the following characters into escapes:
    Character Escape
    \ \\
    ' \'
    " \"
    0x0A \n
    0x0D \r
    0x09 \t
  2. Encoding of all other unprintable characters into Unicode escapes:
    \uxxxx
    Exactly which characters are considered unprintable depends on the character encoding of the (HTML) output format specified in the format parameter.
Parameters:

str

Specify the string to encode.
format
Specify the output format, which provides the character encoding of the destination output.

When this parameter is not specified, the output format associated with the current template will be used by default. That is the same as the call: encodeJScriptString(str, output.format)

If this parameter is null, the ASCII encoding will be assumed. That is, all characters beyond the interval:

0x20 <= c < 0x80
will be converted into Unicode escapes.
Returns:
The string ready to be inserted in the generated HTML output as a JavaScript constant.

See Also:

GOMContext.output, OutputFormat.encoding