Just received this on Embarcadero forum.

You are assigning an Ansi literal string to a Unicode string so a conversion 
from the current Ansi locale is occurring.
Try assigning a unicode literal:

UnicodeString S= L"\u0085";

That L in front of the string makes Code==133 and it’s also 133 inside the udf 
after retrieval using sqlite3_value_text16.

Why does it always turn out to be my own fault ☹

Many thanks to all who contributed.




From: x<mailto:tam118...@hotmail.com>
Sent: 08 August 2017 09:24
To: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] hex and char functions

I accidentally deleted the latest 3 replies to this thread in my mail so 
apologies for not including any content from those mails.

Ryan, the error happens immediately in c++ builder. E.g.

UnicodeString S=”\u0085”;
Int Code=S[1];

Code returns 63 (x3F) which is code for ‘?’ and the question mark is also what 
shows when I hover the cursor over S during debugging.
As u+0085 is a control character, and so has no associated graphic, I can 
forgive the ‘?’ being printed in its place but why does the underlying Code 
change? I have posted this question on the c++ builder website and will post 
any answer here.


Simon’s timing with his comment about debugging is spooky. Last night I found 
that when I try to ‘Evaluate/Modify’ S[1] during debugging I get the following 
error message

E2015 Ambiguity between 'System::UnicodeString::System::UnicodeString::operator 
[](const int)' and 'System::UnicodeString::System::UnicodeString::operator 
[](const int)'

Ambiguity between X and X?? I had no such problems earlier yesterday but, as it 
was working fine when I first encountered the ‘\u0085’ problem, I doubt it’s 
the debugger.


I conducted the following experiment in SQLite Expert Pro by creating a couple 
of new empty databases.
select hex(char(65,133,66))
returned
'41C28542' when the current db was utf-8
'410085004200' when the current db was utf-16le
'004100850042' when the current db was utf-16be

The bottom one of those is what I expected when I first ran the select yet I 
think I'm right in saying my system (windows 10) is little endian. This is a 
further confusion thrown into the mix for me. As is usually the case. I've 
little doubt sqlite is coming up with the right answer in each case.

Tom
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to