This topic tells you about the Application Accelerator UseEncoding
transform in Tanzu Application Platform (commonly known as TAP).
When considering files in textual form, for example, when doing text replacement with the ReplaceText transform, the engine must decide which encoding to use.
By default, UTF-8
is assumed. If any files must be handled differently, use the UseEncoding
transform to annotate them with an explicit encoding.
UseEncoding
returns an error if you apply encoding to files that have already been explicitly configured with a particular encoding.
type: UseEncoding
encoding: <encoding> # As recognized by the java java.nio.charset.Charset class
condition: <SpEL expression>
Supported encoding names include, for example, UTF-8
, US-ASCII
, and ISO-8859-1
.
UseEncoding
is typically used as an upfront transform to, for example, ReplaceText in a chain:
type: Chain # Or using "Combo"
transformations:
- type: UseEncoding
encoding: ISO-8859-1
- type: ReplaceText
substitutions:
- text: "hello"
with: "#howToSayHello"