99 lines
6.8 KiB
HTML
99 lines
6.8 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Java character encodings" />
|
||
|
<meta name="abstract" content="Java programs can convert data in different formats, enabling your applications to transfer and use information from many kinds of international character sets." />
|
||
|
<meta name="description" content="Java programs can convert data in different formats, enabling your applications to transfer and use information from many kinds of international character sets." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="international.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="gettime.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="crtinter.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="fileenc.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="default.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="charenc" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Java character encodings</title>
|
||
|
</head>
|
||
|
<body id="charenc"><a name="charenc"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Java character encodings</h1>
|
||
|
<div><p>Java™ programs can convert data in different formats,
|
||
|
enabling your applications to transfer and use information from many kinds
|
||
|
of international character sets.</p>
|
||
|
<p>Internally, the Java virtual machine (JVM) always operates
|
||
|
with data in Unicode. However, all data transferred into or out of the JVM
|
||
|
is in a format matching the file.encoding property. Data read into the JVM
|
||
|
is converted from file.encoding to Unicode and data sent out of the JVM is
|
||
|
converted from Unicode to file.encoding.</p>
|
||
|
<p>Data files for Java programs are stored in the integrated file system.
|
||
|
Files in the integrated file system are tagged with a coded character set
|
||
|
identifier (CCSID) that identifies the character encoding of the data contained
|
||
|
in the file. See the <a href="fileenc.htm">File.encoding values and iSeries™ CCSID</a> table
|
||
|
for description of how file.encoding is correlated to CCSID on the iSeries server.</p>
|
||
|
<p>When data is read by a Java program, it is expected to be in the
|
||
|
character encoding matching file.encoding. When data is written to a file
|
||
|
by a Java program,
|
||
|
it is written in a character encoding matching file.encoding. This also applies
|
||
|
to Java source
|
||
|
code files (.java files) processed by the javac command and to data sent and
|
||
|
received through Transmission Control Protocol/Internet Protocol (TCP/IP)
|
||
|
sockets using the .net package.</p>
|
||
|
<p>Data read from or written to System.in, System.out, and System.err are
|
||
|
handled differently than data read from or written to other sources when they
|
||
|
are assigned to stdin, stdout, and stderr. Since stdin, stdout, and stderr
|
||
|
are normally attached to EBCDIC devices on the iSeries server, a conversion is performed
|
||
|
by the JVM on the data to convert from the normal character encoding of file.encoding
|
||
|
to a CCSID matching the iSeries job CCSID. When System.in, System.out, or
|
||
|
System.err are redirected to a file or socket and are not directed to stdin,
|
||
|
stdout, or stderr, this additional data conversion is not performed and the
|
||
|
data remains in a character encoding matching file.encoding.</p>
|
||
|
<p>When data must be read into or written from a Java program in a character encoding other
|
||
|
than file.encoding, the program can use the Java IO classes java.io.InputStreamReader,
|
||
|
java.io.FileReader, java.io.OutputStreamReader, and java.io.FileWriter. These Java classes
|
||
|
allow specifying a file.encoding value that takes precedence over the default
|
||
|
file.encoding property currently in use by the JVM.</p>
|
||
|
<p>Data to or from the DB2/400 database, through the JDBC APIs, converts to
|
||
|
or from the CCSID of the iSeries database.</p>
|
||
|
<p>Data that is transferred to or from other programs through Java Native
|
||
|
Interface does not get converted.</p>
|
||
|
<p>For more information about internationalization, see <a href="../nls/rbagsglobalmain.htm" target="_blank"><span class="keyword">i5/OS™</span> globalization</a>.</p>
|
||
|
<p>You can also see <a href="javaapi/guide/intl/index.html" target="_blank">Internationalization by Sun Microsystems, Inc.</a> for
|
||
|
more information.</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="fileenc.htm">File.encoding values and iSeries CCSID</a></strong><br />
|
||
|
This table shows the relation between possible file.encoding values
|
||
|
and the closest matching iSeries coded character set identifier (CCSID).</li>
|
||
|
<li class="ulchildlink"><strong><a href="default.htm">Default file.encoding values</a></strong><br />
|
||
|
This table shows how the file.encoding value is set based on the iSeries coded
|
||
|
character set identifier (CCSID) when the Java virtual machine starts.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="international.htm" title="You can customize your Java programs for a specific region of the world by creating internationalized Java program. By using time zones, locales, and character encoding, you can ensure that your Java program reflects the correct time, place, and language.">Internationalization</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="gettime.htm" title="When you have Java programs that are sensitive to time zones, you should configure the time zone on your server so that your Java programs use the correct time.">Time zone configuration</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="crtinter.htm" title="If you need to customize a Java program for a specific region of the world, you can create an internationalized Java program with Java locales.">Examples: Creating an internationalized Java program</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|