[fpc-pascal] TSQLQuery.ApplyUpdates problem with UTF-8
Dennis Poon
dennis at avidsoft.com.hk
Mon Mar 24 13:51:25 CET 2014
LacaK wrote:
> 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.
>
>
Laco,
My apology. My last attempt did not recreate a fresh database table for
testing so it started with the ruined table values and thus did not give
the correct result.
Your Set Names command did the trick.
Thanks a lot.
By the way, why isn't a semicolon required at the end of SET NAMES
'utf8' command? I tried both with and without semicolon and neither
raise an error.
Dennis
More information about the fpc-pascal
mailing list