Chapter 7. Languages support

Table of Contents
7.1. Character sets
7.2. Making multi-language search pages
7.3. Segmenters for Chinese, Japanese, Korean and Thai languages
7.4. Multilingual servers support

7.1. Character sets

7.1.1. Supported character sets

DataparkSearch supports almost all known 8 bit character sets as well as some multi-byte charsets including Korean euc-kr, Chinese big5 and gb2312, Japanese shift-jis, euc-jp and iso-2022-jp, as well as UTF-8. Some multi-byte character sets are not supported by default, because the conversion tables for them are rather large that leads to increase of the executable files size. See configure parameters to enable support for these charsets.

DataparkSearch also supports the following Macintosh character sets: MacCE, MacCroatian, MacGreek, MacRoman, MacTurkish, MacIceland, MacRomania, MacThai, MacArabic, MacHebrew, MacCyrillic, MacGujarati.

Table 7-1. Language groups

Language groupCharacter sets
Arabiccp864, ISO-8859-6, MacArabic, windows-1256
Armenianarmscii-8
Balticcp775, ISO-8859-13, ISO-8859-4, windows-1257
CelticISO-8859-14
Central Europeancp852, ISO-8859-16, ISO-8859-2, MacCE, MacCroatian, MacRomania, windows-1250
Chinese SimplifiedGB2312, GBK
Chinese TraditionalBig5, Big5-HKSCS, cp950, GB-18030
Cyrilliccp855, cp866, cp866u, ISO-8859-5, KOI-7, KOI8-C, KOI8-R, KOI8-U, MacCyrillic, windows-1251
Georgiangeorgian-academy, georgian-ps, geostd8
Greekcp869, cp875, ISO-8859-7, MacGreek, windows-1253
Hebrewcp862, ISO-8859-8, MacHebrew, windows-1255
Icelandiccp861, MacIceland
IndianMacGujarati, tscii
IranianISIRI3342
JapaneseEUC-JP, ISO-2022-JP, Shift_JIS
KoreanEUC-KR
Laocp1133
Nordiccp865, ISO-8859-10
South EurISO-8859-3
TajikKOI8-T
Thaicp874, ISO-8859-11, MacThai
Turkishcp1026, cp857, ISO-8859-9, MacTurkish, windows-1254
Unicodesys-int, UTF-16BE, UTF-16LE, UTF-8
VietnameseVISCII, windows-1258
Westerncp437, cp500, cp850, cp860, cp863, IBM037, ISO-8859-1, ISO-8859-15, MacRoman, US-ASCII, windows-1252

7.1.2. Character sets aliases

Each charset is recognized by a number of its aliases. Web servers can return the same charset in different notation. For example, iso-8859-2, iso8859-2, latin2 are the same charsets. There is support for charsets names aliases which search engine can understand:

Table 7-2. Charsets aliases

armscii-8armscii-8, armscii8
Big5big-5, big-five, big5, bigfive, cn-big5, csbig5
Big5-HKSCSbig5-hkscs, big5_hkscs, big5hk, hkscs
cp10261026, cp-1026, cp1026, ibm1026
cp11331133, cp-1133, cp1133, ibm1133
cp437437, cp437, ibm437
cp500500, cp500, ibm500
cp775775, cp775, ibm775
cp850850, cp850, cspc850multilingual, ibm850
cp852852, cp852, ibm852
cp855855, cp855, ibm855
cp857857, cp857, ibm857
cp860860, cp860, ibm860
cp861861, cp861, ibm861
cp862862, cp862, ibm862
cp863863, cp863, ibm863
cp864864, cp864, ibm864
cp865865, cp865, ibm865
cp866866, cp866, csibm866, ibm866
cp866u866u, cp866u
cp869869, cp869, csibm869, ibm869
cp874874, cp874, cs874, ibm874, windows-874
cp875875, cp875, ibm875, windows-875
cp950950, cp950, windows-950
EUC-JPcseucjp, euc-jp, euc_jp, eucjp, ujis, x-euc-jp
EUC-KRcseuckr, euc-kr, euc_kr, euckr
GB-18030gb-18030, gb18030
GB2312chinese, cn-gb, csgb2312, csiso58gb231280, euc-cn, euc_cn, euccn, gb2312, gb_2312-80, iso-ir-58
GBKcp936, gbk, windows-936
georgian-academygeorgian-academy
georgian-psgeorgian-ps
geostd8geo8-gov, geostd8
IBM037037, cp037, csibm037, ibm037
ISIRI3342isiri-3342, isiri3342
ISO-2022-JPcsiso2022jp, iso 2022-jp, iso-2022-jp
ISO-8859-1cp819, csisolatin1, ibm819, iso 8859-1, iso-8859-1, iso-ir-100, iso8859-1, iso_8859-1, iso_8859-1:1987, l1, latin-1, latin1
ISO-8859-10csisolatin6, iso 8859-10, iso-8859-10, iso-ir-157, iso8859-10, iso_8859-10, iso_8859-10:1992, l6, latin-6, latin6
ISO-8859-11iso 8859-11, iso-8859-11, iso8859-11, iso_8859-11, iso_8859-11:1992, tactis, thai, tis-620, tis620
ISO-8859-13iso 8859-13, iso-8859-13, iso-ir-179, iso8859-13, iso_8859-13, l7, latin-7, latin7
ISO-8859-14iso 8859-14, iso-8859-14, iso-ir-199, iso8859-14, iso_8859-14, iso_8859-14:1998, l8, latin-8, latin8
ISO-8859-15iso 8859-15, iso-8859-15, iso-ir-203, iso8859-15, iso_8859-15, iso_8859-15:1998, l9, latin-0, latin-9, latin0, latin9
ISO-8859-16iso 8859-16, iso-8859-16, iso-ir-226, iso8859-16, iso_8859-16, iso_8859-16:2000
ISO-8859-2csisolatin2, iso 8859-2, iso-8859-2, iso-ir-101, iso8859-2, iso_8859-2, iso_8859-2:1987, l2, latin-2, latin2
ISO-8859-3csisolatin3, iso 8859-3, iso-8859-3, iso-ir-109, iso8859-3, iso_8859-3, iso_8859-3:1988, l3, latin-3, latin3
ISO-8859-4csisolatin4, iso 8859-4, iso-8859-4, iso-ir-110, iso8859-4, iso_8859-4, iso_8859-4:1988, l4, latin-4, latin4
ISO-8859-5csisolatincyrillic, cyrillic, iso 8859-5, iso-8859-5, iso-ir-144, iso8859-5, iso_8859-5, iso_8859-5:1988
ISO-8859-6arabic, asmo-708, csisolatinarabic, ecma-114, iso 8859-6, iso-8859-6, iso-ir-127, iso8859-6, iso_8859-6, iso_8859-6:1987
ISO-8859-7csisolatingreek, ecma-118, elot_928, greek, greek8, iso 8859-7, iso-8859-7, iso-ir-126, iso8859-7, iso_8859-7, iso_8859-7:1987
ISO-8859-8csisolatinhebrew, hebrew, iso 8859-8, iso-8859-8, iso-ir-138, iso8859-8, iso_8859-8, iso_8859-8:1988
ISO-8859-9csisolatin5, iso 8859-9, iso-8859-9, iso-ir-148, iso8859-9, iso_8859-9, iso_8859-9:1989, l5, latin-5, latin5
KOI-7iso-ir-37, koi-7, koi7
KOI8-Ccskoi8c, koi8-c, koi8c
KOI8-Rcskoi8r, koi8-r, koi8r
KOI8-Tcskoi8t, koi8-t, koi8t
KOI8-Ucskoi8u, koi8-u, koi8u
MacArabicmacarabic
MacCEcmac, macce, maccentraleurope, x-mac-ce
MacCroatianmaccroation
MacCyrillicmaccyrillic, x-mac-cyrillic
MacGreekmacgreek
MacGujaratimacgujarati
MacHebrewmachebrew
MacIcelandmacisland
MacRomancsmacintosh, mac, macintosh, macroman
MacRomaniamacromania
MacThaimacthai
MacTurkishmacturkish
Shift_JIScsshiftjis, ms_kanji, s-jis, shift-jis, shift_jis, sjis, x-sjis
sys-intsys-int
tsciitscii
US-ASCIIansi_x3.4-1968, ascii, cp367, csascii, ibm367, iso-ir-6, iso646-us, iso_646.irv:1991, us, us-ascii
UTF-16BEutf-16, utf-16be, utf16, utf16be
UTF-16LEutf-16le, utf16le
UTF-8utf-8, utf8
VISCIIcsviscii, viscii, viscii1.1-1
windows-1250cp-1250, cp1250, ms-ee, windows-1250
windows-1251cp-1251, cp1251, ms-cyr, ms-cyrl, win-1251, win1251, windows-1251
windows-1252cp-1252, cp1252, ms-ansi, windows-1252
windows-1253cp-1253, cp1253, ms-greek, windows-1253
windows-1254cp-1254, cp1254, ms-turk, windows-1254
windows-1255cp-1255, cp1255, ms-hebr, windows-1255
windows-1256cp-1256, cp1256, ms-arab, windows-1256
windows-1257cp-1257, cp1257, winbaltrim, windows-1257
windows-1258cp-1258, cp1258, windows-1258

7.1.3. Recoding

indexer recodes all documents to the character set specified in the LocalCharset command in your indexer.conf file. Internally recoding is implemented using Unicode. Please note that if some recoding can't convert a character directly from one charset to another, DataparkSearch will use HTML numeric character references to escape this character (i.e. in form &#NNN; where NNN - a character code in Unicode). Thus, for any LocalCharset you do not lost any information about indexed documents, but on LocalCharset selection depend the database volume you will get after indexing.

7.1.4. Recoding at search time

You may display search results in any charset supported by DataparkSearch. Use BrowserCharset command in search.htm to select charset for search results. This charset may be different from LocalCharset specified. All recodings will done automatically.

7.1.5. Document charset detection

indexer detects document character set in this order:

  1. "Content-type: text/html; charset=xxx"

  2. <META NAME="Content-Type" CONTENT="text/html; charset=xxx">

    Selection of this variant may be switch off by command: GuesserUseMeta no in your indexer.conf.

  3. Defaults from "Charset" field in Common Parameters

7.1.6. Automatic charset guesser

DataparkSearch has an automatic charset and language guesser. It currently recognizes more than 100 various charsets and languages. Charset and language detection is implemented using "N-Gram-Based Text Categorization" technique. There is a number of so called "language map" files, one for each language-charset pair. They are installed under /usr/local/dpsearch/etc/langmap/ directory by default. Take a look there to check the list of currently provided charset-language pairs. Guesser works fine for texts bigger than 500 characters. Shorter texts may not be guessed well.

7.1.6.1. LangMapFile command

Load language map for charset and language guesser from the given file. You may specify either absolute file name or a name relative to DataparkSearch /etc directory. You may use several LangMapFile commands.

LangMapFile langmap/en.ascii.lm

7.1.6.2. Build your own language maps

To build your own language map use dpguesser utility. In addition, your need to collect file with language samples in charset desired. For new language map creation, use the following command:

        dpguesser -p -c charset -l language < FILENAME > language.charset.lm

You can also use dpguesser utility for guessing document's language and charset by existing language maps. To do this, use following command:

        dpguesser [-n maxhits] < FILENAME

For some languages, it may be used few different charset. To convert from one charset supported by DataparkSearch to another, use dpconv utility.

        dpconv [OPTIONS] -f charset_from -t charset_to [configfile] < infile > outfile
You may also specyfy -e switch for dpconv to use HTML escape entities for input, and -E switch - for output.

By default, both dpguesser and dpconv utilities is installed into /usr/local/dpsearch/sbin/ directory.

DataparkSearch can update language and charset maps automatically while indexing, if remote server is supply exactly specified language and charset with pages. To enable this function, specify the following command in your indexer.conf file:

LangMapUpdate yes

By default, DataparkSearch uses only first 512 bytes of each file indexed to detect language and charset. You may change this value using GuesserBytes command. Use value of 0 to use all text from document indexed.

GuesserBytes 16384

7.1.7. Default charset

Use RemoteCharset command in indexer.conf to choose the default charset of indexed servers.

7.1.8. Default Language

You can set default language for Servers by using DefaultLang indexer.conf variable. This is useful while restricting search by URL language.

DefaultLang <string>

Default language for server. Can be used if you need language restriction while doing search.

DefaultLang en

7.1.9. LocalCharset command

Defines the charset which will be used to store data in database. All other character sets will be recoded into given charset. Take a look into Section 7.1> for detailed explanation how to choose a LocalCharset depending on languages used on your site(s). This command should be used once and takes global effect for the config file. Take a look into documentation to check whole list of supported charsets. Default LocalCharset is iso-8859-1 (latin1).

LocalCharset koi8-r

7.1.10. ForceIISCharset1251 command

This option is useful for users which deals with Cyrillic content and broken (or misconfigured ?) Microsoft IIS web servers, which tends to not report charset correctly. This is really dirty hack, but if this option is turned on it is assumed that all servers which reports as 'Microsoft' or 'IIS' have content in Windows-1251 charset. This command should be used only once in configuration file and takes global effect. Default: no

ForceIISCharset1251 yes

7.1.11. RemoteCharset command

RemoteCharset <charset>

<charset> is default character set for the server in next Server, Realm or Subnet command(s). This is required only for "bad" servers that do not send information about charset in header: "Content-type: text/html; charset=some_charset" and do not have <META NAME="Content" Content="text/html; charset="some_charset"> Can be set before every Server, Realm or Subnet command and takes effect till the end of config file or till next RemoteCharset command. Default value is iso-8859-1 (latin1).

RemoteCharset iso-8859-5

7.1.12. URLCharset command

URLCharset <charset>

<charset> is character set for the URL argument in next Server, Realm or URL command(s). This command specify character set only for arguments in commands follow and havn't effect on charset detection for indexing pages. Have less priority than RemoteCharset. Can be set before every Server, Realm or URL command and takes effect till the end of config file or till next URLCharset command. Default value is ISO-8859-1 (latin1).

URLCharset KOI8-R

7.1.13. CharsToEscape command

CharsToEscape "\"&<>![]"

Use this command in your search template to specify the list of characters to escape for $&(x) search template meta-variables.



Geo Visitors Map who's online