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

@ -240,12 +240,13 @@ jQuery(function($) {
var loc = isSameUrl(this, window.location.href) ? current_url : this;
var idx = loc.indexOf('?');
var uri = loc.replace(/#$/, '');
var act, re, v, toReplace;
var act, re, v, toReplace, query_string;
if (typeof(val)=='undefined') val = '';
if (idx != -1) {
var query_string = uri.substr(idx+1, loc.length), args = {}, q_list = [];
var args = {}, q_list = [];
query_string = uri.substr(idx + 1, loc.length);
uri = loc.substr(0, idx);
query_string.replace(/([^=]+)=([^&]*)(&|$)/g, function(all,key,val) { args[key] = val; });
@ -258,9 +259,12 @@ jQuery(function($) {
}
query_string = q_list.join('&');
uri = uri+(query_string?'?'+query_string:'');
uri = uri + (query_string ? '?' + encodeURI(query_string) : '');
} else {
if (String(val).trim()) uri = uri+'?'+key+'='+val;
if (String(val).trim()) {
query_string = '?' + key + '=' + val;
uri = uri + encodeURI(query_string);
}
}
re = /^https:\/\/([^:\/]+)(:\d+|)/i;
@ -290,7 +294,7 @@ jQuery(function($) {
// insert index.php if it isn't included
uri = uri.replace(/\/(index\.php)?\?/, '/index.php?');
return encodeURI(uri);
return uri;
};
/**