Cannot transliterate character between character sets

This happens when you have data in database stored in one character set, but the transliteration to required character set fails. There are various points where character set transliteration occurs. There is an automatic one:

Every piece of data you retrieve from database (via SELECT or otherwise) is transliterated from character set of database table's column to connection character set. If character sets are too different, there will be two traslations: first from column charset to Unicode and then from Unicode to the connection charset.

Also, you can request transliteration manually by CASTing the column to another charset, example:

CAST(column_name AS varchar(100) character set WIN1251).

The reason that transliteration can fail is that simply some characters don't exist in certain character sets. For example, WIN1252 doesn't contain any Cyrillic characters, so if you use connection charset WIN1252 and try to SELECT from a column with Cyrillic characters, you may get such error.

In modern internationalized computer world, it is best to use Unicode or UTF8 in your applications and UTF8 connection character - if your connectivity library has provisions for it. And make sure you use at least Firebird 2.0, which has excellent UTF8 support.

Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

All contents are copyright © 2007-2024 unless otherwise stated in the text.

Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

 Installation and setup
 Backup and restore
 Connectivity and API
 Errors and error codes