【发布时间】:2010-06-28 12:43:11
【问题描述】:
我正在使用这里的代码:http://phlymail.com/en/downloads/idna/download/ 并构建了一个这样的函数(来自示例):
function convert_to_punycode($inputstring)
{
$IDN = new idna_convert();
// The input string, if input is not UTF-8 or UCS-4, it must be converted before
$inputstringutf8 = utf8_encode($inputstring);
// Encode it to its punycode presentation
$outputstringpunycode = $IDN->encode($inputstringutf8);
return $outputstringpunycode;
}
但它不能正常工作。
For the input: Россию It gives: РоÑÑÐ¸Ñ Whereas it should give: xn--h1alffa3f
我做错了什么?正在传递的 $inputstring 是一个没有特殊声明/等的普通字符串...
【问题讨论】: