开发者

turkish characters in php and sql

开发者 https://www.devze.com 2023-03-25 17:07 出处:网络
I\'m currently working on a php sql based translation database and am having issues getting the 6 distinct Turkish characters into 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

精彩评论

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