luan-nvg / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

ArgumentOutOfRangeException with unicode characters > 255 #55

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Adding unicode characters with values larger than 255 causes an 
ArgumentOutOfRangeException.

This happens in util_c.cs in the case insensitive string compare methods. 
The C version stores everything in utf-8 so this is not a problem, but in 
C# everything is in utf-16, so a simple 255 char upper / lower table does 
not work. Instead, char.ToLower and char.ToUpper should be used.

Original issue reported on code.google.com by JJX...@gmail.com on 22 Feb 2010 at 8:15

GoogleCodeExporter commented 8 years ago
StringComparer.OrdinalIgnoreCase would also be useful here

Original comment by JJX...@gmail.com on 22 Feb 2010 at 8:18

GoogleCodeExporter commented 8 years ago
1) can you give me a code sample to reproduce
2) There is the keyword NOCASE to handle this 

Original comment by noah.hart@gmail.com on 22 Feb 2010 at 9:30

GoogleCodeExporter commented 8 years ago
I am using NOCASE on all my columns.

I noticed that your SqliteCommand implementation removes any non-ASCII 
character 
when setting the CommandText property. This means that any non-ASCII character 
in 
any command will get changed to a question mark, such as the Chinese characters 
in 
your test code.

Unfortunately this happens when I run a long and complex process with lots of 
Chinese data. I tried using just a small sample of the data and didn't get any 
errors, although I had to use SqliteCommand with parameters to get around the 
problem I mention above. If I can get it to reproduce with a small enough 
sample 
size to include in a project for you, I will do so.

Original comment by JJX...@gmail.com on 22 Feb 2010 at 11:39

GoogleCodeExporter commented 8 years ago
Looks to be problem with SqliteCommand, not C#-SQLite

Original comment by noah.hart@gmail.com on 12 Mar 2010 at 11:31

GoogleCodeExporter commented 8 years ago

Original comment by noah.hart@gmail.com on 17 Feb 2011 at 2:00