On 18-9-2018 17:33, Alex Peshkoff via Firebird-devel wrote:
On 09/16/18 07:58, Kjell Rilbe wrote:
Hi,

Got no reply in firebird-support, so trying here. I've been using Firebird since a long time, successfully using quoted identifiers with Swedish characters åäö in them, but have now stumbled upon a problem. I am at version 3.0.3 (on Windows Server 2016, 64 bit).

Tried this code in C# using FirebirClient 6.3.0.0:

Dictionary<string, FbTransactionBehavior> locks = new Dictionary<string, FbTransactionBehavior>() {   { "KörningInstans", FbTransactionBehavior.Protected | FbTransactionBehavior.LockWrite },   { "Körning", FbTransactionBehavior.Protected | FbTransactionBehavior.LockWrite }
}; // Note "ö" in table names above!
FbTransaction trans = connection.BeginTransaction(new FbTransactionOptions() {
  LockTables = locks,
  TransactionBehavior = FbTransactionBehavior.Consistency | FbTransactionBehavior.Write
}); // Exception

The BeginTransaction call fails with an exception "arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets". Error code in the exception is 335544321. SQLSTATE 22000. It contains 3 errors:
1. type 1, error code 335544321, no message.
2. type 1, error code 335544565, no message.
3. type 0, error code 335544321, message "arithmetic exception, numeric overflow, or string truncation\r\nCannot transliterate character between character sets".

The database is created like this in isql:
create database 'KorningarDev' user DEV password '***' page_size 4096 set names 'UTF8' default character set UTF8 collation UNICODE;

And the connection string looks like this:
Server=xxx.xxx.xxx.xxx;Port=3050;Database=KorningarDev;Charset=UTF8;User=DEV;Password=***

I see no reason why there would be any transliteration problems: Windows unicode -> UTF8, and then UTF8 all the way, right?

Is this a bug, and would that bug be most likely in .NET FirebirdClient or in the FB engine? (I.e. where should I report it?)


Look like a bug. At least I do not see any place where engine transliterates TPB in the code. On the other hand not sure was this particular bug caused by this or with given connection parameters .net client should provide all string already in utf8.
Test case using native client is highly welcome.

It looks like the Firebird .net provider uses Encoding.Default for TPB string properties, which on most platforms - IIRC - is not UTF-8, see https://github.com/cincuranet/FirebirdSql.Data.FirebirdClient/blob/74580961c9ada64aea49dcaabacae0de4fac3540/Provider/src/FirebirdSql.Data.FirebirdClient/Common/TransactionParameterBuffer.cs#L38

Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to