Firebird Database does not recognize unicode/cyrillic letters

心不动则不痛 提交于 2020-01-02 23:04:23

问题


I really need someone's help with the encoding issue when trying to query Firebird tables.

I am connecting to a firebird database using Firebird Maestro:

The problem is that whenever I include Cyrillic letters in SQL Queries Firebird does not 'understand' them correctly.

For instance, consider a query with some cyrillic letters:

SELECT * FROM ROYALTY
WHERE ROYALTY.PRIM = 'Кириллица'

It does not return any values even though there is a row that contains 'Кириллица' value in a PRIM row.

However, everything works fine when using only latin letters:

SELECT * FROM ROYALTY
WHERE ROYALTY.PRIM = 'Latin letters'

Can somebody suggest what to do, please?

Here are screenshots to make my point clear:

I've tried connecting to the database with the following charsets with no positive results:

  • NONE
  • ISO8859_5
  • DOS866
  • CYRL
  • WIN1251
  • UNICODE_FSS

Additional info:

  • Firebird version: 2.5.2
  • Firebird Maestro version 7.7.0.1 (Eng)
  • I've tried both Russian and English versions of Windows

回答1:


check the charset you are using for this column and also be sure to use as connection charset, the charset of your system. try also with Flamerobin or DatabaseWorbench, or may be the Firebird Maestro can help you, it's clearly related to the tool your are using. Firebird itself have no problem using Cyrillic letters And for the Charset in your database choose UTF8.




回答2:


The problem here is that you are not using parameterized queries. In IBExpert you can put a ":name" semi-colon and the name of your parameter, and it will prompt with the window below.

In Java/C# .Net use the API to create queries with parameters. Right now what you are doing is providing non ANSI characters into the SQL string, and that is not saving how you expected.

I see that you are using Firebird Maestro, I'm not sure what that product uses for parameters but it is worth a look in their documentation to see what it is. http://www.sqlmaestro.com/products/firebird/maestro/help/10_04_00_query_parameters/ Actually it appears to be the same format a colon and a name for the parameter.



来源:https://stackoverflow.com/questions/21785736/firebird-database-does-not-recognize-unicode-cyrillic-letters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!