Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

domainToASCII and domainToUnicode in intl #44

Closed
watilde opened this issue Apr 26, 2017 · 2 comments
Closed

domainToASCII and domainToUnicode in intl #44

watilde opened this issue Apr 26, 2017 · 2 comments

Comments

@watilde
Copy link
Member

watilde commented Apr 26, 2017

Currently, we're using uidna_nameToASCII_UTF8 or uidna_nameToUnicodeUTF8 when users call domainToASCII or domainToUnicode with the url modules, but accoding to the specification it should be uidna_IDNToASCII and uidna_IDNToUnicode instead of them.

Then this test case doesn't work because of it. The inputs will be ., .. and 0..0x300 in this case.

How about adding the following methods into node_i18n to fix this issue?

  • binding('intl').IDNToASCII
  • binding('intl').IDNToUnicode
@rmisev
Copy link

rmisev commented Apr 26, 2017

This problem is related to nodejs/node#11549.

I think uidna_nameToASCII_UTF8 is suitable: to match VerifyDnsLength = false (that means also to allow empty labels), you can just ignore following errors in pInfo->errors: UIDNA_ERROR_EMPTY_LABEL, UIDNA_ERROR_LABEL_TOO_LONG, UIDNA_ERROR_DOMAIN_NAME_TOO_LONG.

uidna_nameToUnicodeUTF8 is also suitable. You can ignore some errors in pInfo->errors (please recheck which), because URL standard (https://url.spec.whatwg.org/#concept-domain-to-unicode) says:

  1. Signify validation errors for any returned errors, and then, return result.

AFAIK, idna_IDNToASCII and uidna_IDNToUnicode are deprecated.

@watilde
Copy link
Member Author

watilde commented Apr 28, 2017

@rmisev You're right! Thank you so much for following up with the great detail.

Closing as resolved.

@watilde watilde closed this as completed Apr 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants