Skip to content

@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: builder/lib/processors/nonAsciiEscaper.js, line 58

Parameters: ​
NameTypeDescription
parametersobjectParameters
Properties:
NameTypeAttributesDescription
resourcesArray<@ui5/fs/Resource>List of resources to be processed
optionsobjectoptionalOptions
Properties
NameTypeAttributesDefaultDescription
encodingstringoptional"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: builder/lib/processors/nonAsciiEscaper.js, line 113

Parameters: ​
NameTypeDescription
encodingstringencoding labels: "UTF-8" and "ISO-8859-1"
Returns: ​

node.js character encoding string, e.g. utf8 and latin1

Type: string