我正在处理来自 ISO-3166 的国名文本文件,以仅将国名提取到数组中。问题是当我输出数组时,某些国家的特殊字符丢失或更改:
$country_1 = fopen("./country_names_iso_3166.txt", "r");
while( !feof($country_1) ) { // go through every line of file
$country = fgets( $country_1 );
if( strstr($country, ",") ) // if country name contains a comma
$i = strpos( $country, "," ); // index position of comma
else
$i = strpos( $country, ";" ); // index position of semicolon
$country = substr( $country, 0, $i ); // extract just the country name
$countries[] = $country;
}
所以现在当我输出数组时,例如,第二个国家名称应该是 ÅLAND ISLANDS,但是它输出为 LAND ISLANDS...请告知如何解决这个问题。