|
[
Permalink
| « Hide
]
Jiri Cincura added a comment - 24/Sep/19 10:47 AM
To make it clear, the column is WIN1251 and the connection charset (in connection string) is UTF8, right?
WIN1251 is a cyrillic character set and does not contain é or ë. If you stored those characters, then you likely did that with connection character set NONE, and you will need to fix it by casting to NONE and then to the right character set (probably WIN1252).
@Mark Good point. Why does Firebird not reject characters that are not part of the column character set?
Data originates from (old) Delphi applications that use the default NONE connection character set to connect to Firebird.When read back in Delphi under NONE or WIN1251, there is no problem. I guess in .NET this goes wrong due to .NET's preference for Unicode as in-between character set. If you connect with character set NONE the byte values received are simply stored as is (this is a bit of an oversimplification though). Bytes themselves only have meaning in a character set, so it is impossible to reject them because byte 0xEB in WIN1252 is ë, while in WIN1251 it is л.
A possible solution (but test them on a copy of your database) is to do the following 1. alter the character set of the column to NONE 2. update all rows, explicitly updating the column (ie UPDATE yourtable SET yourcolumn = yourcolumn) 3. alter the character set of the column to WIN1252 Note: don't change directly from WIN1251 to WIN1252, because that would yield transliteration errors on read. This is also why step 2 is necessary. @Mark Thanks! I was hoping to avoid having to modify the database, but it looks like I'll have to.
|