Retail:How to support new Character Unicode Blocks
Contents |
Introduction
The Openbravo Hardware Manager can be configured to use the charsets supported by the receipt printers and customer displays connected to it. The charsets configured must go in a file named META-INF/unicodeblocks.xml, packaged in a .jar file and placed in the folder /libext.
Configuration
The configuration file META-INF/unicodeblocks.xml has one entry for each character set supported and has the following syntax:
<block name="CYRILLIC" codetable="Cp855" command="1B 74 22"/>
Where there are defined the following attributes:
- name: Is the name of one of the character unicode block listed in the Java class Character.UnicodeBlock: http://docs.oracle.com/javase/7/docs/api/java/lang/Character.UnicodeBlock.html . This means that this configuration line will be used for all characters that belongs to this Unicode block.
- codetable: Is the name of one of the character encodings supported by the Java platform as described in the document http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html . This is the encoding used to translate the characters that belong to the unicode block.
- command. The byte sequence used by the receipt printer or customer display to set the code table. It is coded in hexadecimal format and each byte can be separated by spaces.
Example
The following example is the base META-INF/unicodeblocks.xml that goes in the Hardware Manager package to support Chinese Unified Ideographs, Cyrillic and Greek character sets appart from the Latin character set.
<?xml version="1.0" encoding="UTF-8"?> <unicodeblocks> <block name="CJK_UNIFIED_IDEOGRAPHS" codetable="GB2312" command=""/> <block name="CYRILLIC" codetable="Cp855" command="1B 74 22"/> <block name="GREEK" codetable="ISO8859_7" command="1B 74 0F"/> </unicodeblocks>
Package and Install
The file META-INF/unicodeblocks.xml must be packaged in a .jar file. To do this create a new unicodeblocks.xml file in a subfolder named META-INF. To package it execute the following instruction from the command line:
jar cvf myunicodeblocks.jar .
This instruction creates a new file named myunicodeblocks.jar that contains the unicodeblocks.xml inside a folder META-INF.
To install just copy the file myunicodeblocks.jar into the subfolder /libext of the installed Hardware Manager, and restart the application.