开发者

how to handle unicode data in delphi7

in my application ,i am sending data from my application to database i am getting some odd characters in my database like this

how to handle unicode data in delphi7

i am sending my data like this

var
 w:widestring;
 u:utf8string;
begin
   w:=data //data is function to get some info(string)
   u:=utf8encode(w);
   sendfn(u);
end;

i am using utf8_decode(my get data) in my php code before adding to my database.

and my database and tables collation is utf8_genera开发者_开发百科l_ci

can anyone help me in this issue


It's an educated guess, but does the Data function return an UTF-8 string instead of a WideString? I think the error could be in this Data function that you're calling, which returns the data in the wrong string format.


The php function utf8_decode converts characters from utf-8 to ISO-8859-1. If the path your data take (the browser or whatever component you use to send your data to the web server (http request, your php installation, your webpage and your database connection) from your delphi app to your database that is behind you webpage are able to support and configured to use utf-8 data you don't need the utf8_decode function, you can just insert your data the way it comes.

If you haven't already configured php to work with UTF-8, be aware that it is difficult and never works 100% (for me at least it never did), so maybe it would be better for you to use data in your locale encoding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜