Using Different Character Sets with Ephox EditLive! for Java

Introduction

Ephox EditLive! for Java supports multiple character sets which allow it to be used in an international environment.  The character set used by EditLive! for Java can be specified either in a <META> tag in the <HEAD> of the document to be placed in EditLive! for Java or in the XML configuration for EditLive! for Java, this is most useful when only a fragment of HTML is to be loaded into EditLive! for Java.   

Supported Character Sets

EditLive! for Java supports the display and usage of the following character sets:

Canonical Name Description
ASCII American Standard Code for Information Interchange
CP1252 Windows Latin-1
UTF8 Eight-bit Unicode Transformation Format
UTF-16 Sixteen-bit Unicode Transformation Format
ISO2022CN ISO 2022 CN, Chinese
ISO2022JP JIS X 0201, 0208 in ISO 2022 form, Japanese
ISO2022KR ISO 2022 KR, Korean
ISO8859_1 ISO 8859-1, Latin alphabet No. 1
ISO8859_2 ISO 8859-2, Latin alphabet No. 2
ISO8859_3 ISO 8859-3, Latin alphabet No. 3
ISO8859_4 ISO 8859-4, Latin alphabet No. 4
ISO8859_5 ISO 8859-5, Latin/Cyrillic alphabet
ISO8859_6 ISO 8859-6, Latin/Arabic alphabet
ISO8859_7 ISO 8859-7, Latin/Greek alphabet
ISO8859_8 ISO 8859-8, Latin/Hebrew alphabet
ISO8859_9 ISO 8859-9, Latin alphabet No. 5
ISO8859_13 ISO 8859-13, Latin alphabet No. 7
ISO8859_15 ISO 8859-15, Latin alphabet No. 9
SJIS Shift-JIS, Japanese

Setting the Character Set via the Document

The character set to be used within EditLive! for Java can be specified in the document to be loaded into EditLive! for Java.  This method of setting the character set can be used when loading a document into EditLive! for Java by setting the whole document for EditLive! for Java and not just the body.  In order to set the character set in this way a <META> tag specifying the character set must be included into the <HEAD> of the document to be loaded into EditLive! for Java.  The character set specified in the document <HEAD> has precedence over any character set specified in the XML configuration for EditLive! for Java.

Example

In this example the character set is specified as ASCII.

<HTML>
    <HEAD>
        ...
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ASCII"/>
        ...
    </HEAD>
    ...
</HTML>

Setting the Character Set via the XML Configuration

The character set to be used within EditLive! for Java can be specified in the XML configuration for the particular instance of EditLive! for Java concerned.  This method of setting the character set can be used in any circumstance, however, any character set specified in the document loaded into EditLive! for Java will have precedence over a character set specified within the XML configuration should a conflict occur.

Specifying the character set in this manner is the only way in which the character set can be defined for HTML fragments which are loaded into EditLive! for Java.  Thus, if you specify only the body of the document to be loaded into EditLive! for Java and not the whole document then the only way the character set can be specified is within the XML configuration for EditLive! for Java.

In order to set the character set for EditLive! for Java via the XML file the character set must be specified in the <meta> element.  For more information on the <meta> element and other XML elements see the EditLive! for Java XML Reference.

Example

In this example the character set is specified as ASCII.

<editLiveForJava>
    <document>
        <html>
            <head>
                <meta content="text/html; charset=ASCII" http-equiv="Content-Type"/>
                ...
            </head>
            ...
        </html>
    </document>
    ...
</editLiveForJava>

Summary

The character set for use with an instance of EditLive! for Java can be specified within the document loaded into EditLive! for Java or within the XML configuration for the instance of EditLive! for Java.  A character set specified in the document that is loaded into EditLive! for Java has precedence over a character set specified in the XML configuration of the instance of EditLive! for Java.  In order to specify a character set for use with a HTML fragment specified via setting the body content for EditLive! for Java the character set must be specified in the XML configuration file.

See Also