I try to convert an internationalized Domain Name (IDN) into its punycode equivalent using the idn function from OS (Ubuntu). Here is my simple script :
<?php
$dom = "名がドメイン.net";
echo $dom."\n";
exec("idn $dom", $out, $var);
print_r($out);
echo "\n";
echo "result :$var\n";
?>
This code is not working into my browser, $out is an empty array and $var = 1 (guess there is an error). But when I run the code with php-cli, everything is fine and the result as it should be :
名がドメイン.net
Array
(
[0] => xn--v8jxj3d1dzdz08w.net
)
result :0
Do you have some clue of what is happening ?