make_valid_utf8
函式
適用於: Databricks Runtime 15.4 和更新版本
傳回字串,其中 中的所有無效UTF-8位元組序列 strExpr
都會由Unicode取代字元 (U+FFFD
)。
語法
make_valid_utf8(strExpr)
引數
strExpr
:STRING
運算式。
傳回
, STRING
由有效的UTF-8位元組sequencea所組成。
範例
– Simple example taking a valid string as input.
> SELECT make_valid_utf8('Spark')
Spark
– Simple example taking a valid collated string as input.
> SELECT make_valid_utf8('SQL' COLLATE UTF8_LCASE)
SQL
– Simple example taking a valid hexadecimal string as input.
> SELECT make_valid_utf8(x'61')
a
– Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT make_valid_utf8(x'80')
�
- Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT make_valid_utf8(x'61C262')
a�b