Я попытался преобразовать домен: http://pfeffermühle.com в правильный домен IDN в виде Punycode. Я использовал vb.net и php, но оба результата неверны.PHP idn_to_ascii/VB.net idn.GetAscii() не приводит к правильному домену PONY CODE/IDN
VB.net:
Dim idn As New System.Globalization.IdnMapping()
Dim punyCode As String = idn.GetAscii(http://pfeffermühle.com)
RESULT: punyCode= xn--http://pfeffermhle-06b.com
PHP:
echo idn_to_ascii('http://pfeffermühle.com');
RESULT: xn--http://pfeffermhle-06b.com
Но правильный результат: http://xn--pfeffermhle-0hb.com
Вы можете проверить его здесь:
http://www.idnconverter.se/http://xn--pfeffermhle-0hb.com
В чем проблема?
Пожалуйста, помогите.
Благодаря
добавил РНР к ответу, так что это более полный –
Спасибо очень :) :) – memme
извините, исправить это будет: $ s1 = "hTtps: //pfeffermühle.com"; $ s = отделка ($ s1); if (idn_to_ascii ($ s) <> $ s) { if (substr (strtolower ($ s), 0, 7) === "http: //") { \t $ s = "http:// ". idn_to_ascii (substr ($ s, 7, strlen ($ s) -7)); \t} elseif (substr (strtolower ($ s), 0, 8) === "https: //") { \t $ s = "https: //" .idn_to_ascii (substr ($ s, 8, StrLen ($ s) -8)); \t} } echo $ s. "
" .idn_to_ascii ($ s1); – memme