Page 1 of 1
unicode Suporte ?
Posted: 11.04.2009, 10:24
by solook
hello
i installed zeos 7 in delphi2009
so it can not show arabic text as good
i add this code :
memo1.Text:=utf8toansi(ZTable1.FieldByName('arabic').AsString);
and word good ..how can i soled it?
Posted: 11.04.2009, 11:55
by jfr
Maybe the related question. Delphi 2009 with Zeos 7 installed, MySql 5.1, a database with table filled with utf8 values (Polish, Russian and Baltic names). Simple application: a DBGrid on a form, connected to DataSource. When I'm using ADOConnection and ADOTable as DataSource.DataSet then all is OK, I can see all names displayed properly. But ZConnection with ZTable don't work, even after 'SET NAMES utf8' query after ZConnection.Connect. A string with characters pair for all utf8 characters is displayed.
Moreover: let
strValue := qry.FieldByName('utf8field').AsString;
then
1. if qry is ADOQuery, then I can display strValue on control (TEdit, TMemo...) and I have to use AnsiToUtf8(strValue) in html
2. if qry is ZQuery, then I have to use Utf8ToAnsi(strValue) to display it on control and I can put strValue into html.
So why different behaviour for similiar components?
A day later.
OK, probably it's a question for Delphi or MySql. It's strange, but when using ADO all depends on table collation. If set to utf8_general_ci, then ADO behaves like ZEOS, string returned is in utf8. But if table collation is set to specific one, eg utf8_unicode_ci or utf8_polish_ci, then the returned string is ansi, displayable on a form.
For ZEOS changing the collation has no effect.
BTW: but it would be nice to have utf-8 strings displayed properly on dataaware controls connected using ZEOS.