Chapter 57. UTL_I18N

Table of Contents

57.1. Overview
57.2. Functions
57.2.1. RAW_TO_CHAR
57.2.2. STRING_TO_RAW
57.2.3. UNESCAPE_REFERENCE

This chapter briefly introduces the UTL_I18N package, and describes how to use the procedures and functions of the package.

57.1. Overview

UTL_I18N provides various functions for conversion and compatibility between different countries and languages.

57.2. Functions

This section describes the functions provided by the UTL_I18N package, in alphabetical order.

57.2.1. RAW_TO_CHAR

Converts RAW data to a string in the current database character set.

Details about the RAW_TO_CHAR function are as follows:

  • Prototype

    UTL_I18N.RAW_TO_CHAR 
    (
        data            IN      RAW,
        src_charset     IN      VARCHAR2
    ) 
    RETURN VARCHAR2;
  • Parameter

    ParameterDescription
    dataBinary data of the input string.
    src_charsetCharacter set of the input string.
  • Example

    DECLARE
        v_in_raw raw(100) := '74696265726F';
        x varchar2(100);
    BEGIN
        x := UTL_I18N.RAW_TO_CHAR (v_in_raw, 'UTF8');
    END;

57.2.2. STRING_TO_RAW

Converts an input string in the current database character set to binary data in another character set.

Details about the STRING_TO_RAW function are as follows:

  • Prototype

    UTL_I18N.STRING_TO_RAW 
    (
        data            IN      VARCHAR2,
        dst_charset     IN      VARCHAR2
    ) 
    RETURN RAW;
  • Parameter

    ParameterDescription
    dataInput string in the current database character set.
    dst_charsetDestination character set.
  • Example

    DECLARE
        v_in_string varchar2(100) := 'sample_string';
        x raw(100);
    BEGIN
        x := UTL_I18N.STRING_TO_RAW (v_in_string, 'UTF8');
    END;

57.2.3. UNESCAPE_REFERENCE

Converts an input string including escape characters to a string excluding the escape characters.

Details about the UNESCAPE_REFERENCE function are as follows:

  • Prototype

    UTL_I18N.UNESCAPE_REFERENCE 
    (
        str             IN      VARCHAR2
    ) 
    RETURN VARCHAR2
  • Parameter

    ParameterDescription
    strInput string.
  • Example

    DECLARE
        v_in_string varchar2(100) := '<123>';
        x varchar2(100);
    BEGIN
        x := UTL_I18N.UNESCAPE_REFERENCE (v_in_string);
    END;