All Products
Search
Document Center

MaxCompute:IS_ENCODING

Last Updated:May 15, 2025

IS_ENCODING function checks whether the input string str can be converted from the specified source encoding (from_encoding) to the target encoding (to_encoding). Additionally, it can detect whether the resulting string is corrupted or appears as garbled text after conversion. A typical scenario involves setting from_encoding to UTF-8 and to_encoding to GBK.

Syntax

boolean is_encoding(string <str>, string <from_encoding>, string <to_encoding>)

Parameters

  • str: required. A value of the STRING type. If this parameter is an empty string, the string belongs to any character set.

  • from_encoding and to_encoding: required. Values of the STRING type. from_encoding specifies the source character set and to_encoding specifies the destination character set.

Return value

A value of the BOOLEAN type is returned. The return value varies based on the following rules:

  • If the string specified by str can be converted, True is returned. Otherwise, False is returned.

  • If the value of from_encoding or to_encoding is NULL, the result will be NULL.

Related functions

IS_ENCODING is a string function. For more information about functions related to string searches and conversion, see String functions.