Project

Profile

Help

How to connect?
Download (1.93 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.4 / hej / net / sf / saxon / serialize / charcode / package.html @ a3c08363

1
<html>
2

    
3
<head>
4
<title>Package overview for net.sf.saxon.charcode</title>
5
</head>
6

    
7
<body>
8

    
9
<p>This package provides classes for handling different character sets, especially
10
    when serializing the output of a query or transformation. </p>
11

    
12
<p>Most of the classes in this package are implementations of the interface <code>CharacterSet</code>.
13
    The sole
14
function of these classes is to determine whether a particular character is present in the
15
character set or not: if not, Saxon has to replace it with a character reference.</p>
16

    
17
<p>The actual translation of Unicode characters to characters in the selected encoding
18
is left to the Java run-time library. (Note that different versions of Java support
19
different sets of encodings, and there is no easy way to find out which encodings
20
are supported in a given installation).</p>
21

    
22
<p>It is possible to configure Saxon to support additional character sets by writing an
23
implementation of the <code>CharacterSet</code> interface, and registering this class with the
24
<code>Configuration</code> using the call <code>getCharaterSetFactory().setCharacterSetImplementation()</code></p>
25

    
26
<p>If an output encoding is requested that Saxon does not recognize, but which the Java
27
platform does recognize, then Saxon attempts to determine which characters the encoding
28
can represent, so that unsupported characters can be written as numeric character references.
29
Saxon wraps the Java <code>CharSet</code> object in a <code>JavaCharacterSet</code> object,
30
and tests whether a character is encodable by calling the Java interrogative
31
<code>encoding.canEncode()</code>, caching the result locally. Since this mechanism
32
appears to have become reliable in JDK 1.5, it is now used much more widely than before,
33
and most character sets are now supported in Saxon by relying on this mechanism.</p>
34

    
35

    
36

    
37
<hr>
38

    
39
<p align="center"><i>Michael H. Kay<br/>
40
Saxonica Limited<br/>
41
9 June 2009</i></p>
42
</body>
43
</html>
(9-9/9)