开发者

turkish characters in php and sql

I'm currently working on a php sql based translation database and am having issues getting the 6 distinct Turkish characters into sql.

the page is set to a utf charset and I have tried using utf8_encode to no effect, I am also using Cyrillic on the page so am stuck having it all in utf8.

at the moment I am just trying to pass the value from a form via post and then echoing it out, but that is also failing.

any help would be greatly appreciated.

edit*

managed to get it to 开发者_如何学JAVAoutput in an echo with htmlentities, unfortunately it is now not entering sql properly. the field is set to utf8_unicode_ci

update code is below

mysql_query("SET NAMES UTF8");
mysql_query("UPDATE turkish='$turkish'  WHERE tid='$tid'");


When doing updates do it this way:

mysql_query( "UPDATE turkish = _utf8'$turkish'  WHERE tid='$tid'" );

don't use utf8_encode or anything similar just make sure $turkish contains valid utf-8 data.

and when reading:

SELECT tid, BINARY turkish, ...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜