Page tree
Skip to end of metadata
Go to start of metadata

Ephox EditLive! supports multiple character sets which allow it to be used in an international environment. Specifying the character set used by an instance of EditLive! defines which characters the editor can correctly render.

For a comprehensive list of the character sets supported by EditLive!, please see the Character Sets Supported article. 

Default Character Set

If a character set is not specified, the default character set for the user's JVM will be applied to the editor. This means the editor will exhibit different behaviour depending on the system language of the current user. On English Windows systems, the default character set is ISO8859_1 (also known as CP1252). If, for example, you attempt to load content urlencoded as UTF-8 into the editor without specifying the UTF-8 characters set, a user loading the editor on English Windows would corrupt all unicode characters - eg "å" will be turned into "Ã¥". This corruption is not reversible.

Specifying EditLive!'s Character Set

The character set used by EditLive! can be specified by the following:

  • Using the setDocument Method
    A <meta> tag containing the character set specification can be added when specifying the XHTML document to load into an instance of EditLive!.
  • Specifying the Character Set in the EditLive! Configuration File
    A <meta> tag containing character set specification can be nested in the <head> element of the EditLive! configuration file.
Using the Document Load Time Property

The character set to be used within EditLive! can be specified in the document using the Document load time property. In order to specify the character set in this way, a <meta> tag must be included into the <head> of the document to be loaded into EditLive!.

The following instantiation of EditLive! shows how to specify a character set of ASCII.

<script src="../../redistributables/editlivejava/editlivejava.js"></script>
<script language="JavaScript">
   var editlivejava1;
   editlivejava1 = new EditLiveJava("ELJApplet1", "700", "400");
   editlivejava1.setDocument(escape("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ASCII\" /></head><body><h1>Body Text</h1></body></html>"));;

Note: If character encoding is specified by using the setDocument Method, then this will be the final character encoding used. If an instance of EditLive! utilizes a configuration file that specifies character encoding, the character encoding will still be set to the value specified in the document loaded into the editor via the setDocument Method.

Specifying the Character Set In the EditLive! Configuration File

A meta tag explicitly specifying the character encoding can be entered into the configuration file for EditLive!.

To specify ASCII character encoding, the following tag should be entered between the <head> tags of the configuration file as such:

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

Specifying the Output Character Set

The methods above specify how to define which character set is used to load and render the content in EditLive!. When extracting content from EditLive!, the default operation is to encode the outgoing content with the same character set specified for loading the content. If no character set has been specified for loading, the UTF-8 character set will be used for encoding outgoing content. Note the input vs output distinction; in such a scenario the system default would still be used for loading, which gives unpredictable results depending on user machine configurations.

Encoding characters with UTF-8 will correctly extract the content of EditLive! for most rendering character sets.

If you are experiencing problems regarding the content extracted from EditLive! not matching the content displayed in the editor, this may be due to an incompatibility between your rendering character set and the output character set. To explicitly set your output character set, use the setOutputCharset Method.

See Also

  • No labels