@ui5/builder/processors/nonAsciiEscaper

Methods

(static) default(parameters) → {Promise.<Array.<@ui5/fs/Resource>>}

Description:
  • Escapes non ASCII characters with unicode escape sequences. A leading UTF-8 Byte Order Mark (BOM, U+FEFF) is removed before escaping. Otherwise it would be escaped to a literal "\\uFEFF" sequence at the start of the content, corrupting the first key of a *.properties file. The removal is gated on the decoded content starting with U+FEFF, not on the encoding name: a UTF-8 BOM decodes to a leading U+FEFF and is removed, whereas an ISO-8859-1 (latin1) decode can never produce U+FEFF (its code points are limited to U+0000-U+00FF), so latin1 files are left untouched. ```js const encoding = nonAsciiEscaper.getEncodingFromAlias("ISO-8859-1"); nonAsciiEscaper({resources, options: {encoding}}); ```
Source:
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Attributes Description
resources Array.<@ui5/fs/Resource> List of resources to be processed
options object <optional>
Options
Properties
Name Type Attributes Default Description
encoding string <optional>
"utf8" resource file encoding (Node.js character encodings). Use #getEncodingFromAlias to get the encoding string
Returns:
Promise resolving with the processed resources
Type
Promise.<Array.<@ui5/fs/Resource>>

(static) getEncodingFromAlias(encoding) → {string}

Description:
  • Provides a mapping from user-friendly encoding name (alias) such as "UTF-8" and "ISO-8859-1" to node specific encoding name such as "utf8" or "latin1". Simplifies usage of nonAsciiEscaper encoding option such that it can be used standalone without the respective task (e.g. in Splitter, Bundler and related projects).
Source:
Parameters:
Name Type Description
encoding string encoding labels: "UTF-8" and "ISO-8859-1"
Returns:
node.js character encoding string, e.g. utf8 and latin1
Type
string