Function: text.decode Stay organized with collections Save and categorize content based on your preferences.
Decodes given data to string, assuming the specified character set.
Each byte that cannot be correctly decoded using the specified charset isrepresented in the output by the\uFFFD codepoint.
Arguments
| Arguments | |
|---|---|
data |
The input to be decoded. |
charset |
The IANA charset name; e.g. |
Returns
The decoded text.
Raised exceptions
| Exceptions | |
|---|---|
ValueError | If the charset is unsupported. |
Examples
# Return "Hello World" using `text.decode` function-assignStep:assign:# Assign Base64 text "Hello World"-base64Text:"SGVsbG8gV29ybGQ="# Decode Base64 text into bytes-decodedBytes:${base64.decode(base64Text)}-returnStep:# Decode bytes to stringreturn:${text.decode(decodedBytes, "UTF-8")}
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.