Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const initialN = 128; // 0x80
const delimiter = '-'; // '\x2D'

/** Regular expressions */
const regexPunycode = /^xn--/;
const regexPunycode = /^xn--/i;
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators

Expand Down Expand Up @@ -389,7 +389,7 @@ const encode = function(input) {
const toUnicode = function(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
? decode(string.slice(4))
: string;
});
};
Expand Down
8 changes: 8 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ const testData = {
'decoded': 'caf\xE9.com',
'encoded': 'xn--caf-dma.com'
},
{
'decoded': 'ÜBER.COM',
'encoded': 'xn--BER-ska.COM'
},
{
'decoded': 'sPhÈRè.com',
'encoded': 'xn--sPhR-nka7q.com'
},
{
'decoded': '\u2603-\u2318.com',
'encoded': 'xn----dqo34k.com'
Expand Down