All Products
Search
Document Center

MaxCompute:IS_ENCODING

Last Updated:Aug 07, 2023

Determines whether the input string str can be converted from the character set specified by from_encoding into the character set specified by to_encoding. This function can also be used to determine whether the input string is garbled. In most cases, from_encoding is set to utf-8 and to_encoding is set to gbk.

Syntax

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

Parameters

  • str: optional. A value of the STRING type. If this parameter is not specified or an empty string is specified, 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, an error is returned.

Related functions

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