fix #1181 한글 도메인 처리 개선

- default URL을 IDN으로 지정 시 punycode로 변환하여 저장
- request_uri 및 current_url를 punycode로 변환하지 않은 IDN으로 출력하도록 변경
- String.prototype.setQuery()에서 IDN을 인코딩하지 않도록 변경 thanks to @andjfrrk
This commit is contained in:
bnu 2015-03-05 16:27:47 +09:00
parent da1b59e3e8
commit d6a898a7f2
4 changed files with 40 additions and 11 deletions

View file

@ -410,6 +410,16 @@ class Context
$this->set('current_url', $current_url);
$this->set('request_uri', self::getRequestUri());
if(strpos($current_url, 'xn--') !== FALSE)
{
$this->set('current_url', self::decodeIdna($current_url));
}
if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
{
$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
}
}
/**
@ -1081,6 +1091,18 @@ class Context
return $obj->str;
}
function decodeIdna($domain)
{
if(strpos($domain, 'xn--') !== FALSE)
{
require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
$IDN = new idna_convert(array('idn_version' => 2008));
$domain = $IDN->decode($domain);
}
return $domain;
}
/**
* Force to set response method
*