All Products
Search
Document Center

PolarDB:UTL_I18N

Last Updated:Jul 25, 2024

UTL_I18N is a group of services that provide additional globalization features for applications written in PL/SQL. The services are composed of ESCAPE_REFERENCE and UNESCAPE_REFERENCE functions.

ESCAPE_REFERENCE

  • Syntax

    • UTL_I18N.ESCAPE_REFERENCE(
          str            IN VARCHAR2 CHARACTER SET ANY_CS,
          page_cs_name   IN VARCHAR2 DEFAULT NULL)
       RETURN VARCHAR2 CHARACTER SET str%CHARSET;
  • Parameters

    • Parameter

      Description

      str

      The input string.

      page_cs_name

      The character set of the document.

  • Description

    • The ESCAPE_REFERENCE function converts a text string to its character reference counterparts for the characters that fall outside the character set used in the current document. Character references are used in HTML and XML documents to represent characters. This is independent of the encoding of the document. Character references can appear in two forms: numeric character references and character entity references.

      The following character sets are supported:

      • SQL_ASCII

      • UTF8

      • EUC_CN

      • GB18030

      • ISO_8859_5

      • LATIN1

  • Examples

    • -- ESCAPE_REFERENCE
      select UTL_I18N.ESCAPE_REFERENCE('hello < '||chr(229),'sql_ascii');
       escape_reference  
      -------------------
       hello &lt; &#xe5;
      (1 row)

UNESCAPE_REFERENCE

  • Syntax

    • UTL_I18N.UNESCAPE_REFERENCE ( 
         str IN VARCHAR2 CHARACTER SET ANY_CS)
       RETURN VARCHAR2 CHARACTER SET str%CHARSET;
  • Parameters

    • Parameter

      Description

      str

      The input string.

  • Description

    • The UNESCAPE_REFERENCE function returns a string from an input string that contains character references. This function decodes each character reference into the corresponding character value.

  • Examples

    • -- UNESCAPE_REFERENCE
      select UTL_I18N.UNESCAPE_REFERENCE('hello &lt; &#xe5;');
       unescape_reference 
      --------------------
       hello < å
      (1 row)