Closed gsmlg closed 10 years ago
I've found out why.
"abc.com.".split('.')
in IE 8 will return ['abc','com', undefined]
"abc.com.".split(/\x2E/)
in IE 8 will return ['abc', 'com']
.
This only happens when using split
with a regular expression.
Using string instead of regex for split. Here is quick fix:
diff --git a/punycode.js b/punycode.js
index a9999d8..db0a17f 100644
--- a/punycode.js
+++ b/punycode.js
@@ -103,7 +103,8 @@
result = parts[0] + '@';
string = parts[1];
}
- var labels = string.split(regexSeparators);
+ string = string.replace(regexSeparators, '\x2E');
+ var labels = string.split('.');
var encoded = map(labels, fn).join('.');
return result + encoded;
}
If the domain name ends with a
.
, in IE8 the last.
will be removed bytoUnicode
.