This page is for an old version of Hexaly Optimizer. We recommend that you update your version and read the documentation for the latest stable release.

Charset module

The charset module contains the list of all the encoding schemes supported by LocalSolver and the methods required to query that list.

A charset is not useful on its own, but it can be used in conjunction with the I/O module to read or write files with the appropriate encoding.

Complete list of supported encodings

The following table lists all the encodings supported by the modeler of LocalSolver with their common aliases and the languages for which the encoding is usually employed.

Encoding name Aliases Languages
ascii us-ascii English
cp437 pc-8, ibm437 English
cp1250 windows-1250 Central and Eastern Europe
cp1251 windows-1251 Bulgarian, Serbian and Macedonian
cp1252 windows-1252 Western Europe
cp1253 windows-1253 Modern greek
cp1254 windows-1254 Turkish
cp1255 windows-1255 Hebrew
cp1256 windows-1256 Arabic
cp1257 windows-1257 Estonian, Latvian and Lithuanian
cp1258 windows-1258 Vietnamese
iso-8859-1 latin, latin1 Western Europe
iso-8859-2 latin2 Central and Eastern Europe
iso-8859-3 latin3 Esperanto, Maltese, Turkish
iso-8859-4 latin4 Estonian, Latvian, Lithuanian, Sami
iso-8859-5 cyrillic Bulgarian, Serbian, Russian
iso-8859-6 arabic Arabic
iso-8859-7 greek Greek
iso-8859-8 hebrew Hebrew
iso-8859-9 latin5 Turkish
iso-8859-10 latin6 Nordic languages
iso-8859-11 thai Thai
iso-8859-13 latin7 Baltic languages
iso-8859-14 latin8 Celtic languages
iso-8859-15 latin9 Western Europe
iso-8859-16 latin10 South-eastern Europe
utf-8   All languages
utf-16   All languages
utf-16be   All languages
utf-16le   All languages
utf-32be   All languages
utf-32le   All languages

Constants

This module instantiate 2 encodings by default: utf-8 and iso-8859-1. You can use them directly through these built-in variables without using the charset.lookup() method.

charset.ISO_8859_1

Latin-1 encoding. This encoding is the most widely used for western europe. This is also the default encoding of LocalSolver.

charset.UTF_8

UTF-8 encoding. This encoding should be the default one for your new projects with LocalSolver. The parser of LocalSolver will use it automatically if a Byte-Order-Mark (BOM) is detected at the begining of your files.

Functions

charset.default()

Returns the default encoding used by LocalSolver. For the current version of LocalSolver, this method returns charset.ISO_8859_1.

charset.lookup(name)

Returns the encoding corresponding to the given name. If no encoding exists with the given name, an exception is thrown. You can use the name of the encoding or one of its aliases. The lookup is not case sensitive.