[英]SELECT from data_base utf-8_bin data purified
All I want is to SELECT
an utf8_bin
string stored in an table with 2 rows 我只想
SELECT
一个存储在具有2行的表中的utf8_bin
字符串
1 id
and 2 continut
first is an int(20) NOT NULL AUTO INCREMENT
and second is VARCHAR(2000) utf8_bin NOT NULL
used for Romanian language inserts. 1个
id
和2个continut
是一个int(20) NOT NULL AUTO INCREMENT
,第二个是VARCHAR(2000) utf8_bin NOT NULL
用于罗马尼亚语插入。
The data is stored correct whe i acces it from phpmyadmin, but on echo
it returns strange characters instead romanian diacritics. 当我从phpmyadmin访问数据时,数据已正确存储,但是在
echo
它返回的是奇怪的字符,而不是罗马尼亚的变音符号。
$sqlis = "SELECT continut FROM cantari WHERE id = {$id}";
$dbh->query($sqlis);
foreach ($dbh->query($sqlis) as $liniie);
$continut = $liniie['continut'];
This is the result: Cau?ir uri ?i izvoare
结果是:
Cau?ir uri ?i izvoare
$continut
is my data from sql. $continut
是我来自sql的数据。 I've setted meta on file as utf8 <meta charset="utf-8">
in header's content. 我在标头的内容中将
<meta charset="utf-8">
设置为utf8 <meta charset="utf-8">
。
Can htaccess help me or css? htaccess可以帮助我或CSS吗? or how to replace that elements with the normal Romanian diacritics?
或如何用普通的罗马尼亚变音符号代替这些元素?
Have you set the character set to UTF-8 on the Mysql connection? 您是否已在Mysql连接上将字符集设置为UTF-8?
For example: 例如:
$dbh->set_charset("utf8")
Without it, the data returned from MySQL will be translated to Cp1252. 没有它,从MySQL返回的数据将被转换为Cp1252。 Any chars that don't fit in Cp1252 will be set to "?".
Cp1252中不适合的任何字符都将设置为“?”。
$sqlis = "SELECT continut FROM cantari WHERE id = {$id}; SET NAMES 'utf8' ";
因此,我们所需要做的就是在SQL Server端指定要使用utf8字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.