Hi!
I've download and install mydac for xe2 update4 hotfix1 trial version. I tried to display chinese using charset as big5 and unicode property as false. It can show normal chinese correct. But cannot show the chinese word which we built by ourself(all I used download from http://www.cns11643.gov.tw). for example: ''. The chinese word will be setup start at unicode (E000) in win7. Fetch data from mysql will display as '?' for the word from E000(unicode stored as 0xEE8080 in mysql database). How can I get it correct using mydac component? Thanks!
HERE is my develop enviroment settings:
OS: Win7 32-bit Traditional chinese
tool: C++ Builder XE2 update4 hotfix1
Install program:(Get from www.cns11643.gov.tw)
AIDB_soft_102_1_win32.exe
TW-Kai-98_1.TTF
TW-Sung-91_1.TTF
evaluate mydac about chinese
Re: evaluate mydac about chinese
Hello.
As far as I know, MyDAC does not change the text field data received from the server. If you set the TMyConnection.Options.Charset property, the server converts all sent text data to the specified charset. If the field has the same charset, the sent data does not change and you receive the original data. If you see the '?' symbol, it mean the following:
1) The database did not save your specific character, the '?' character is stored instead.
2) The type, that the IDE uses for storing text data, is not able to store your character.
As far as I know, MyDAC does not change the text field data received from the server. If you set the TMyConnection.Options.Charset property, the server converts all sent text data to the specified charset. If the field has the same charset, the sent data does not change and you receive the original data. If you see the '?' symbol, it mean the following:
1) The database did not save your specific character, the '?' character is stored instead.
2) The type, that the IDE uses for storing text data, is not able to store your character.
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: evaluate mydac about chinese
Hello.
When you set TMyConnection.Options.Charset, MySQL server converts text fields to the specified charset. If on conversion to the specified charset the server doesn't find a correspondent character in this charset, it returns '?' instead.
The following code commands the server to convert an utf8 character with the code 0xEE8080 to big5 and convert the result to a binary. The retrieved result is shown on a client as a byte sequence: Please run this code and check the result of the conversion of the utf8 character with the code 0xEE8080 by the server.
When you set TMyConnection.Options.Charset, MySQL server converts text fields to the specified charset. If on conversion to the specified charset the server doesn't find a correspondent character in this charset, it returns '?' instead.
The following code commands the server to convert an utf8 character with the code 0xEE8080 to big5 and convert the result to a binary. The retrieved result is shown on a client as a byte sequence:
Code: Select all
var
bb: TBytes;
bin_str: string;
i: integer;
begin
MyQuery1.SQL.Clear;
MyQuery1.SQL.Add('SELECT cast(0xEE8080 AS CHAR CHARACTER SET utf8) INTO @str_utf8;');
MyQuery1.SQL.Add('SELECT cast(@str_utf8 AS CHAR CHARACTER SET big5) INTO @str_big5;');
MyQuery1.SQL.Add('SELECT cast(@str_big5 as binary);');
MyQuery1.Open;
bb := MyQuery1.Fields[0].AsBytes;
bin_str := '';
for i := 0 to length(bb) - 1 do
bin_str := bin_str + IntToHex(bb[i],2) + ' ';
ShowMessage(bin_str);
end;Re: evaluate mydac about chinese
Thanks, I'll try it!
I also think this is just charset setting problem. Just don't know how to set connection charset. Thanks for your reply~
I also think this is just charset setting problem. Just don't know how to set connection charset. Thanks for your reply~