22.3 Specifying a Character Set in a JSP or XML File

In Oracle Reports, Web-report templates are configured by default for Western European character encoding. For other languages, you must specify the character encoding for a JSP file by using both the charset attribute of the <meta> tag and the <%@page%> page directive.

To dynamically associate the appropriate character encoding with the JSP file, you can make the following modifications:

  1. In the directory oracle_home/reports/templates/, edit the files rw*.html and blank_template.jsp:

    1. Modify the page directive to read

      <%@ page contentType="text/html;charset=yourIANAencoding" %>

      where,

      yourIANAencoding is the IANA character encoding that corresponds to the character encoding part of your NLS_LANG environment variable.

    2. Modify the <meta> tag inside the <head> tag to read:

      <meta http-equiv="Content-Type"
      content="text/html;charset=yourIANAencoding" />
      
  2. In the directory oracle_home/reports/templates/, edit the file template.xsl:

    1. Modify the <xsl:output> tag to read:

      <xsl:output
           method="jsp"
           indent="yes"
           encoding="yourIANAencoding"
         />
      

      where

      yourIANAencoding is the IANA encoding that corresponds to the character encoding part of your NLS_LANG environment variable.

    2. Add the following page directive:

      <%@ page contentType="text/html;charset=yourIANAencoding" %>
      
    3. Add or modify the <meta> tag inside the <head> tag:

      <meta http-equiv="Content-Type"
      content="text/html;charset=yourIANAencoding" />
      

      where

      yourIANAencoding is the IANA encoding that corresponds to the character encoding part of your NLS_LANG environment variable.

The following example specifies a Japanese character set:

<%@ page contentType="text/html;charset=Shift_JIS" %>
<META http-equiv="Content-Type" content="text/html;charset=Shift_JIS">

Note:

To set the character set in a paper layout report that you plan to use to generate XML, you must include a character set for the report's XML Prolog Value property:

<?xml version="1.0" encoding="&Encoding" ?>

&Encoding is then replaced at runtime with the appropriate setting.

The values expressed for the character set should call a character set that is compatible with the one specified for Oracle Reports Services. The values for character sets used on the Web (IANA-defined character sets) are different from the values expressed in the NLS_LANG environment variable. Table 22-2 lists commonly used IANA-defined character sets for the charset parameter:

Note:

IANA-defined character set values are not case-sensitive. You can enter them in uppercase or lowercase.

Table 22-2 Valid Values for the IANA-Defined Character Sets

Languages Valid IANA-Defined Character Sets

AMERICAN

ISO-8859-1, ISO-8859-15, windows-1252, US-ASCII, UTF-8

ARABIC

ISO-8859-6, windows-1256, UTF-8

ASSAMESE

UTF-8

BANGLA

UTF-8

BENGALI

UTF-8

BRAZILIAN PORTUGESE

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

BULGARIAN

ISO-8859-5, windows-1251, KOI8-R, UTF8

CANADIAN FRENCH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

CATALAN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

CROATIAN

ISO-8859-2, windows-1250, UTF-8

CZECH

ISO-8859-2, windows-1250, UTF-8

DANISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

DUTCH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

EGYPTIAN

ISO-8859-6, windows-1256, UTF-8

ENGLISH

ISO-8859-1, ISO-8859-15, windows-1252, US-ASCII, UTF-8

ESTONIAN

ISO-8859-4, ISO-8859-13, windows-1257, UTF-8

FINNISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

FRENCH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

GERMAN DIN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

GERMAN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

GREEK

ISO-8859-7, windows-1253, UTF-8

GUJARATI

UTF-8

HEBREW

ISO-8859-8-I, windows-1255, UTF-8

HINDI

UTF-8

HUNGARIAN

ISO-8859-2, windows-1250, UTF8

ICELANDIC

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

INDONESIAN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

ITALIAN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

JAPANESE

EUC-JP, Shift_JIS, UTF-8

KANNADA

UTF-8

KOREAN

EUC-KR, UTF-8

LATIN AMERICAN SPANISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

LATVIAN

ISO-8859-4, ISO-8859-13, windows-1257, UTF-8

LITHUANIAN

ISO-8859-4, ISO-8859-13, windows-1257, UTF-8

MALAY

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

MALAYALAM

UTF-8

MARATHI

UTF-8

MEXICAN SPANISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

NORWEGIAN

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

ORIYA

UTF-8

POLISH

ISO-8859-2, windows-1250, UTF8

PORTUGESE

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

PUNJABI

UTF-8

ROMANIAN

ISO-8859-2, windows-1250, UTF-8

RUSSIAN

ISO-8859-5, windows-1251, KOI8-R, UTF-8

SIMPLIFIED CHINESE

GBK, GB18030, UTF-8

SLOVAK

ISO-8859-2, windows-1250, UTF-8

SLOVENIAN

ISO-8859-2, windows-1250, UTF-8

SPANISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

SWEDISH

ISO-8859-1, ISO-8859-15, windows-1252, UTF-8

TAMIL

UTF-8

TELUGU

UTF-8

THAI

TIS-620, UTF-8

TRADITIONAL CHINESE

Big5, Big5-HKSCS, UTF-8

TURKISH

ISO-8859-9, windows-1254, UTF-8

UKRANIAN

ISO-8859-5, windows-1251, KOI8-U, UTF-8

VIETNAMESE

windows-1258, UTF-8