Built-in support of code pagesIn IBProvider v.3.0.0.6327 new codepages processor was implemented. Support of 49 code pages of Firebird and Interbase is available. Using conversion tables and algorithms the provider converts text columns, BLOB fields and arrays into UCS2 format (two-byte Unicode) with which Firebird and Interbase work. In this case the code page of connection to the database is taken into account.Along with text code pages IBProvider supports binary data code page - OCTETS. The Figure shows the scheme for working with charsets:
1. Database charset and text column encodingSet DEFAULT text data charset at database creation. The charset you have chosen will be used for all text data stored in the database. If necessary, you may set the encoding different from the database charset for individual columns, arrays, or BLOB fields.If text column encoding has been set it will be used, and database charset will be ignored. 2. Charset NONEIf database charset has not been set and text column charset has not been defined, NONE encoding will be used.IBProvider has ctype_none property for working with this encoding. It allows to set the charset for text data conversion in NONE encoding. If ctype_none property has not been set, ASCII convertor will be used for NONE:
3. OCTETS charset and binary dataOCTETS encoding serves for binary data storage in text columns. When IBProvider detects this charset it will not use encoding processor, OLE DB and ADO data types will be turned into appropriate binary equivalents CHAR, VARCHAR, and BLOB (see number 3 on the Figure).4-6. Text charsetsEncoding processor is used for charsets different from NONE and OCTETS. See its simplified scheme on the Figure under numbers 4, 5, and 6.Storage encoding - character set of text column or database charset. Connection encoding - is defined by ctype initialization property. If it has been set, the data is read and recorded in this encoding and its storage encoding is ignored Client encoding - text data charset the client works with. Client encoding is set by ctype_user property. For example, data can be stored in the database in WIN1251 and come to client in UTF-8. When text data is recorded into database it is reversely converted into storage encoding or connection encoding. If ctype=NONE server ignores connection charset and uses storage encoding. If ctype_user=NONE provider ignores client charset and represents data to the user in storage encoding or in connection encoding if ctype!=NONE. ctype_user and ctype properties are ignored for NONE and OCTETS charsets. Dynamic client encodings (client charsets).ctype_user permitted values are any charset name supported by the provider and special names of dynamically defined charsets - ACP and OCP.ACP - provider calls GetACP() and converts ACP into WINDOWS-xxx, where xxx is ANSI system charset identifier. OCP - provider calls GetOEMCP() and converts OEM into DOS-xxx, where xxx is OEM system charset identifier. If the provider fails to convert the charset name or it is not supported by the server the provider generates an error. Åñëè íå óäàëîñü êîíâåðòèðîâàòü èìÿ êîäîâîé ñòðàíèöû èëè îíà íå ïîääåðæèâàåòñÿ ñåðâåðîì - ïðîâàéäåð ãåíåðèðóåò îøèáêó. 7. Unicode modeThe provider has unicode_mode property that defines text data publishing format. If unicode_mode = true then it uses Unicode DBTYPE_WSTR data types: WChar, VarWChar, and LongVarWChar. If unicode_mode = false then it uses simple DBTYPE_STR types: Char, VarChar, and LongVarChar.Text columns size in Firebird 2.xIBProvider started to control text columns size when working with Firebird 2 servers in Unicode mode. If the length of loaded data exceeds the text column size the exclusion will be generated. To avoid column size checking connect in ordinary mode and set Unicode_mode=false.Aliases of Firebird and Interbase charsets.IBProvider allows setting the charset by its name, server alias, or by using provider in-built names-aliases. For example, you may define WIN1251 charset by its name WIN1251, by server alias WIN_1251, and through IBProvider aliases WIN-1251 and WINDOWS-1251.Procession of empty characret set namesEmpty values of ctype, ctype_user, and ctype_none properies are changed into NONE.IBProvider Professional v3 supported character sets
Support of data conversion external librariesIn addition to built-in data conversion tables and algorithms, IBProvider v3 can use external library with text data convertors - ICU. This requires to enter icu_library=icuuc30.dll. parameter in the connect string. The client shall have the library with icuuc30.dll converter algorithms and the resource library icudt30.dll. One can take the libraries from Firebird SQL Server set.Be careful to use 32-bit ICU-libraries with IBProvider 32 bit and 64-bit ICU libraries with IBProvider 64 bit. The usage of ICU libraries from Firebird 2.1 set adds the support of GBK and CP943C code pages. Useful linksTags: Firebird, Interbase, Firebird codepages, collations, charsets, Firebird encoding, ODBC Firebird driver, UCS2 format, ODBC Interbase driver, character sets, Firebird oledb provider Supported charsets: ASCII, BIG_5, CYRL, DOS437, DOS737, DOS775, DOS850, DOS852, DOS857, DOS858, DOS860, DOS861, DOS862, DOS863, DOS866, DOS869, EUCJ_0208, GB_2312, ISO8859_1, ISO8859_2, ISO8859_3, ISO8859_4, ISO8859_5, ISO8859_6, ISO8859_7, ISO8859_8, ISO8859_9, ISO8859_13, KOI8R, KOI8U, KSC_5601, NEXT,NONE, SJIS_0208, TIS620, UNICODE_FSS, UTF8, WIN1250, WIN1251, WIN1252, WIN1253, WIN1254, WIN1255, WIN1256, WIN1257, WIN1258, OCTETS, GBK, CP943C |