SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
| Introduction
| Writing extension functions in Java
| Converting Arguments to Java Extension Functions
| Converting the Result of a Java Extension Function
| Writing extension functions for .NET
| Converting Arguments to .NET Extension Functions
| Converting the Result of a .NET Extension Function
| Writing XSLT extension instructions
| Customizing Serialization
| Implementing a collating sequence
| Localizing numbers and dates
» | Adding an output encoding
| Writing a URI Resolver for Input Files
| Writing a URI Resolver for Output Files
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# Adding an output encoding

If you want to use an output encoding that is not directly supported by Saxon (for a list of encodings that are supported, see Encodings) you can do this by writing a Java class that implements the interface `net.sf.saxon.charcode.PluggableCharacterSet`. You need to supply two methods: `inCharSet()` which tests whether a particular Unicode character is present in the character set, and `getEncodingName()` which returns the name given to the encoding by your Java VM. The encoding must be supported by the Java VM. To use this encoding, specify the fully-qualified class name as the value of the encoding attribute in xsl:output.

Alternatively, it is possible to specify the `CharacterSet` class to be used for a named output encoding by setting the system property, e.g. `-D"encoding.EUC-JP"="EUC_JP"`; the value of the property should be the name of a class that implements the `PluggableCharacterSet` interface. This indicates the class to be used when the `xsl:output` element specifies encoding="EUC-JP".

Next