A
A
Artyom2014-09-09 20:09:06
PHP
Artyom, 2014-09-09 20:09:06

How to convert xn--j1ail.xn--p1ai/ to normal url?

Hello,
how can I convert xn--j1ail.xn--p1ai into a clear url using php?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rsa97, 2014-09-09
@artem328

For example, through idna_convert

require_once('idna_convert.class.php'); 
$IDN = new idna_convert();
$domain = 'xn--j1ail.xn--p1ai';
$domain = $IDN->decode($domain);
echo $domain;

V
Valentine, 2014-09-09
@vvpoloskin

A domain with national characters is nothing more than a punycode encoded string with a special prefix. You need to find a lib for your language (as google shows, there is one) that will translate the j1ail and p1ai strings from punycode into the national language entry (Russian)

D
Dmitry, 2014-09-09
@mytmid

Look here:
https://phlymail.com/en/downloads/idna-convert.html
Work example:
http://idnaconv.phlymail.de/index.php?encoded=xn--...

M
Mikhail Osher, 2014-09-10
@miraage

https://github.com/mabrahamde/php-idna-converter

<?php

require_once('vendor/autoload.php');

$idn = new \idna_convert(array('idn_version' => 2008));

echo $idn->encode('lübeck.de'); // prints 'xn--lbeck-kva.de'

echo $idn->decode('xn--lbeck-kva.de') // prints 'lübeck.de'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question