Reference material for CONVERT_FROM function
TEXT
data type, using the database’s encoding.
Parameter | Description | Supported input types |
---|---|---|
<bytes> | A sequence of bytes representing text in <src_encoding> . | BYTEA |
<src_encoding> | The encoding from which the src <bytes> are derived, which must be constant. The supported source encoding aligns with those supported in the ICU library. | TEXT |
CONVERT_FROM
returns a value of type TEXT
.
<src_encoding>
is invalid, an error is thrown.
If <bytes>
are malformed according to <src_encoding>
, the behavior is undefined and may result in replacement characters or errors, depending on the encoding. For example, in UTF-8
encoding, malformed bytes are replaced with the � character.
CONVERT_FROM
to convert the binary input \x1212003100
of type BYTEA
into a TEXT
string using the UTF-16
encoding. All results are displayed in UTF-8
encoding:
ሒ1�
consists of:
ሒ
, the UTF-16
representation of 1212
.1
, the UTF-16
representation of 0031
.�
. Because 00
is a single byte, it does not form a valid UTF-16
sequence.CONVERT_FROM
to convert the binary input \x31a031ffffffff
of type BYTEA
into a TEXT
string using the windows-1252
encoding:
1 1ÿÿÿÿ
, consists of:
1
, the windows-1252 representation of 31
.
, the windows-1252 representation of the non-breaking space character a0.ÿ
, the windows-1252 representation of ff
.BYTEA
column that represents text data in a custom encoding that is specified during data loading:
BYTEA
column col_bytea
into TEXT
using the specified encoding UTF-16
, and inserts it into text_encoded_data
target table:
UTF-16
input encoding with another encoding supported by the ICU library.