CONVERT_REPLACEUTF8

Converts a binary string to a UTF-8 value and replaces all characters that cannot be converted to UTF-8 with the specified replacement character.

Syntax

CONVERT_REPLACEUTF8(binary_value value_to_convert, replacement VARCHAR) → VARCHAR

  • binary_value: The binary string to convert to a string encoded in UTF8.

  • replacement: A single character to use as a substitute for each character in the binary string that cannot be converted to UTF8.

Examples

CONVERT_REPLACEUTF8 example
SELECT CONVERT_REPLACEUTF8(BINARY_STRING('These characters cannot be converted — \xa0\xa1'), 'b')
-- These characters cannot be converted — bb

Last updated