我有一个包含类似内容的utf8 json文件:
"type":"Feature","geometry":{"type":"LineString","coordinates":[[-73.6371999890417,45.451049968774],[-73.6362864025022,45.4507004803266]]},"properties":{"FIN_GCH":191,"TYP_VOIE":"avenue","LIM_GCH":"Montréal-Ouest","NOM_VOIE":"Brock","CLASSE":0,"DEB_DRT":0,"FIN_DRT":0,"LIM_DRT":"Montréal-Ouest","LIE_VOIE":"","DEB_GCH":173,"ID_TRC":1602102,"DIR_VOIE":"Sud","SENS_CIR":-1}}
,{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-73.6382813452807,45.4514760942107],[-73.6371999890417,45.451049968774]]},"properties":{"FIN_GCH":171,"TYP_VOIE":"avenue","LIM_GCH":"Montréal-Ouest","NOM_VOIE":"Brock","CLASSE":0,"DEB_DRT":150,"FIN_DRT":152,"LIM_DRT":"Montréal-Ouest","LIE_VOIE":"","DEB_GCH":143,"ID_TRC":1602103,"DIR_VOIE":"Sud","SENS_CIR":-1}}
在php脚本的帮助下,我将所有数据放在一个mysql UTF8数据库中,但即便如此,这些条目都有奇怪的重音:而不是Montréal-Ouest我有Montréal-Ouest
你知道这是什么问题吗?
谢谢
答案 0 :(得分:0)
我必须通过像这样设置选项数组来设置与服务器的utf8连接
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
);
$connection = new PDO( $dns, $user, $password, $options );
感谢CBroe