Re: [Firebird-net-provider] Transliteration problem with table locks

2018-09-19 Thread Kjell Rilbe

Den 2018-09-19 kl. 09:35, skrev Mark Rotteveel:
Note that your sending this to the old firebird-net-provider mailing 
list (on source forge) not to the new one (on Google Groups).


On 2018-09-18 20:43, Kjell Rilbe wrote:

In firebird-devel, Mark Rotteveel pointed out that the .NET provider
seems to use Encoding.Default for TPB, which is not a good choice,
considering it's system dependent. I assume TPB want a specific
encoding, regardless of client platform.

Please consider replacing with Encoding.UTF8, as indicated in the same
firebird-devel thread, for all strings in TPB.


It is not that simple: for Firebird 2.5 and earlier, using UTF8 for 
strings in the TPB is incorrect unless the connection character set is 
UTF8.


Alright, but the most important point is to never use Ecoding.Default 
directly or indirectly (e.g. via string.ToUpper), because it's platform 
dependent and may turn out right sometimes, but sometimes not. Use well 
defined encodings everywhere.


Regards,
Kjell
<>___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] Transliteration problem with table locks

2018-09-19 Thread Mark Rotteveel
Note that your sending this to the old firebird-net-provider mailing 
list (on source forge) not to the new one (on Google Groups).


On 2018-09-18 20:43, Kjell Rilbe wrote:

In firebird-devel, Mark Rotteveel pointed out that the .NET provider
seems to use Encoding.Default for TPB, which is not a good choice,
considering it's system dependent. I assume TPB want a specific
encoding, regardless of client platform.

Please consider replacing with Encoding.UTF8, as indicated in the same
firebird-devel thread, for all strings in TPB.


It is not that simple: for Firebird 2.5 and earlier, using UTF8 for 
strings in the TPB is incorrect unless the connection character set is 
UTF8.


Mark


___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] Transliteration problem with table locks

2018-09-18 Thread Kjell Rilbe

Den 2018-09-18 kl. 09:00, skrev Kjell Rilbe:

Hi,

I've been using Firebird since a long time, using quoted identifiers 
with Swedish characters åäö in them. I am now at version 3.0.3 (on 
Windows Server 2016, 64 bit).


Now I tried this code in C# using FirebirClient 6.3.0.0:

/*-*/
Dictionary locks = new 
Dictionary() {
  { "KörningInstans", FbTransactionBehavior.Protected | 
FbTransactionBehavior.LockWrite },
  { "Körning", FbTransactionBehavior.Protected | 
FbTransactionBehavior.LockWrite }

};
FbTransaction trans = connection.BeginTransaction(new 
FbTransactionOptions() {

  LockTables = locks,
  TransactionBehavior = FbTransactionBehavior.Consistency | 
FbTransactionBehavior.Write

});
/*-*/

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=*** 



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


What might be going on here? Anything I might be doing wrong? Bug in 
.NET FirebirdClient? Bug in Firebird itself?


Regards,
Kjell Rilbe


In firebird-devel, Mark Rotteveel pointed out that the .NET provider 
seems to use Encoding.Default for TPB, which is not a good choice, 
considering it's system dependent. I assume TPB want a specific 
encoding, regardless of client platform.


Please consider replacing with Encoding.UTF8, as indicated in the same 
firebird-devel thread, for all strings in TPB.


Also, please consider replacing ALL string.ToUpper() and other string 
methods with methods that use a well defined (not platform dependent) 
encoding, i.e. string.ToUpperInvariant(). string.ToUpper() also uses 
Encoding.Default, an so has the same problems as with TPB above.


Finally, when designing test cases, I hope support for non-ascii 
characters in various places are considered and covered.


I wish I could help out better, i.e. fix stuff myslef and submit pull 
requests, but I'm afraid I would need to study the innards of FIrebird 
communication a few years before being able to fix more than I destroy. :-)


Regards,
Kjell
<>___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider