我有一个属性文件,我在PHP中阅读。属性看起来像这样:
destination = "bibliothèque"
然后,我想读取属性为UTF-8。
function utf8_trim($str) {
return preg_replace("/^['p{Z}'p{Cf}'x{200e}'x{200f}'s]*(['s'S]*?)['p{Z}'p{Cf}'x{200e}'x{200f}'s]*$/u", "$1", $str);
}
mb_internal_encoding("UTF-8");
$places = parse_ini_file($filename);
$destination_untrimmed = $places['destination'];
$destination = utf8_trim($destination_untrimmed); //FAILS on this step due to invalid encoding
我正在使用Eclipse 3.8.1。我如何将字符串输入到常量文件中作为UTF-8?
您的ini文件不是utf-8编码的