diff --git a/index.js b/index.js index 54a118a..4f78b4e 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,7 @@ function namehash (inputName) { } function normalize(name) { - return name ? uts46.toAscii(name, {useStd3ASCII: true, transitional: false}) : name + return name ? uts46.toUnicode(name, {useStd3ASCII: true, transitional: false}) : name } module.exports = { diff --git a/package.json b/package.json index d051eb5..56a89da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ensdomains/eth-ens-namehash", - "version": "2.0.14", + "version": "2.0.15", "description": "A simple module for generating ENS namehashes per spec https://github.com/ethereum/EIPs/issues/137", "main": "dist/index.js", "scripts": { diff --git a/test/index.js b/test/index.js index 3dd6bf5..ee474a6 100644 --- a/test/index.js +++ b/test/index.js @@ -47,7 +47,15 @@ test('normalize ascii domain', (t) => { test('normalize international domain', (t) => { t.plan(1) const input = 'fоо.eth' // with cyrillic 'o' - const expected = 'xn--f-1tba.eth' + const expected = 'fоо.eth' + const output = namehash.normalize(input) + t.equal(output, expected) +}) + +test('normalize capitalized domain', (t) => { + t.plan(1) + const input = 'Foo.eth' // latin chars only + const expected = 'foo.eth' const output = namehash.normalize(input) t.equal(output, expected) }) @@ -55,7 +63,7 @@ test('normalize international domain', (t) => { test('normalize emoji domain', (t) => { t.plan(1) const input = '🦚.eth' - const expected = 'xn--qt9h.eth' + const expected = '🦚.eth' const output = namehash.normalize(input) t.equal(output, expected) })