CONVERT_FROM

This is a function for converting a bytea string containing text from the specified encoding to the database's encoding.

Syntax

convert_from ( bytes bytea, src_encoding name ) → text

Remarks

  • An ERROR is raised if the source encoding is not compatible with the database encoding, or the provided string contains an invalid byte sequence for the source encoding.

  • CONVERT_TO provides the equivalent functionality for converting a string from the database encoding to a specified encoding. convert provides functionality to convert between user-specified encodings.

Example

SELECT CONVERT_FROM(hex_to_binary('736f6d655f74657874'), 'UTF8').

Returns a Text value.