Name
bf_text_to_UTF8, bf_text_to_UTF8_or_wide — convert a narrow text value into UTF-8 from a named character set
Synopsis
varchar bf_text_to_UTF8(
|
in text any, |
in charset varchar); |
any bf_text_to_UTF8_or_wide(
|
in text any, |
in charset varchar); |
Description
bf_text_to_UTF8 converts text
(a narrow or wide string, or NULL) into a narrow UTF-8
varchar, interpreting any narrow input as bytes in the
character set named by charset. Pass
NULL for charset to use the
session's default narrow character set. The function complements
charset_recode
by always producing UTF-8 regardless of the source encoding.
bf_text_to_UTF8_or_wide differs only in its return
type: when the input is already a wide string it is returned unchanged (as
nvarchar); narrow inputs are decoded and returned as a wide
string. Useful when downstream processing expects to handle both narrow
and wide forms.
Both return SQL NULL when the input is NULL.