我有一个UTF-8的字符串,并且有代码页(数字)。如何将UTF-8字符串转换为代码页?
答案 0 :(得分:1)
$string = "äöå"; //File is saved as UTF-8
$codepage = unpack("N*",mb_convert_encoding( $string, "UTF-32BE", "UTF-8" ));
var_dump( $codepage );
//array(3) { [1]=> int(228) [2]=> int(246) [3]=> int(229) }
答案 1 :(得分:1)
$out = iconv("UTF-8", 'Windows-1252//TRANSLIT//IGNORE', $out);
需要Windows前缀。也很好转换和忽略