[fpc-pascal] TSQLQuery.ApplyUpdates problem with UTF-8

LacaK lacak at zoznam.sk
Fri Mar 21 11:31:27 CET 2014


Dennis Poon  wrote / napĂ­sal(a):
>
>>> I tried, the results are:
>>>
>>> @@character_set_client      : utf8
>>> @@character_set_connection  : latin1
>>> @@character_set_database   : latin1
>>>
>>>
>> Dennis, do you received my reply?:
>>
>> IMO @@character_set_connection is wrong and must be utf8.
>> I will try fix it, but first can you try as workaround this:
>> - after connection is established can you use 
>> MySQLConnection1.ExecuteDirect('SET NAMES ''utf8''');
>> - and then check again @@character_set_client, 
>> @@character_set_connection (IMO both must be utf8 ... if they will 
>> be, then your program should work as expected ... can you test it 
>> again?)
>>
>> -Laco.
>>
> I tried  MYSQLConnection1.ExecuteDirect('SET NAMES ''utf8'';');
> and recheck
>   @@character_set_client    : utf8
>   @@character_set_connection : utf8
>   @@character_set_database : latin1
>
> So, it corrected one variable.
This is okay now

>
> I re-ran my test but still  ?????? after applyUpdates.
When I use your test program I receve same result as you describe.
But when I add into procedure TForm1.FormCreate(Sender: TObject);
begin
  MySQL55Connection1.ExecuteDirect('SET NAMES ''utf8''');  // <-- ADDED
  SQLQuery1.Open;
end;

It works for me as expected ... so now I am confused with your results  
... can you try again please your test application with added line ...
(it will require patch for mysqlconnection in all cases, but before  
want have confirmed, that it helps)

-Laco.




More information about the fpc-pascal mailing list