最近,我开始利用网络作用和库扎雷后台,建立一个关于云层的连续7个网站。 我非常高兴,直到我打上了一套砖瓦。
我有一台虚拟机器,配有Windows服务器2008 R2, IIS 7.5,服务器2008 R2,作为发展服务器,在我将其上载到云之前试图进行改动。 我在零碎数据库中还有一些额外的表格,以支持我的习惯模块应用。 除其他外,在某个时候,我需要实施一些法典,如:
$r = db_select( my_creators , c )
->fields( c )
->condition( my_url , $creator_url)
->execute()
->fetchAll(PDO::FETCH_ASSOC);
$creator = $r[0];
foreach ($creator as $k => $vv)
$s.= t( @key -->> @value<br> , array( @key => $k, @value => $v));
print $s;
I have cut out a lot of extra code, but this is the code having the problem, when $creator_url has a value with some special character (e.g. André_Breton). This runs perfectly on my development machine, fetching the record and displaying the data so I was very surprised when I uploaded to the cloud and got this error
PDOException: SQLSTATE[IMSSP]: An error occurred translating string for input param 7 to UCS-2: No mapping for the Unicode character exists in the target multi-byte code page. in dblog_watchdog() (line 157 ofE:sitesroot modulesdblogdblog.module).
基础数据库是相同的,实际上,I数据-sync是用于发展ql服务器数据库的数据。 所有特性数据领域均为斜体。
我交叉核对了所有版本的IIS、php、php推广、php.ini和所有版本都是相同的。
我通过增加工作,设法开展这方面的工作。
Database::getConnection()->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_SYSTEM);
$creator_url = iconv( UTF-8 , UCS-2 , $creator_url);
选择之前,然后是印刷
foreach ($creator as $k => $vv) {
$v=iconv( ISO8859-1 , UTF-8 , $vv);
$s.= t( @key -->> @value<br> , array( @key => $k, @value => $v));
}
Using this workaround the select goes through, the correct record is selected and displayed, but then I get several warnings
Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1572 ofE:sitesroot includesootstrap.inc). Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1572 ofE:sitesroot includesootstrap.inc).
这样做是有道理的,因为通常会中断职能,因此所有扼杀物都将是UTF-8。
几天后,我用墙对我的头部进行点击,任何帮助都将受到高度赞赏。
谢谢!