Description
The forthcoming Scala Native cross-build is currently using icu4c for IDNA. Although this works, it introduces various build complexities (see scala-native/scala-native#2778) and requires downstreams to have icu4c installed if they (indirectly) call IDNA related methods.
This motivates a pure Scala IDNA implementation.
-
Does it make sense to do it in ip4s, or an external dependency (hosted where)?
There is plenty of prior art to mimick. They all seem to use some form of source generator. -
Should we swap out the JVM and JS implementations as well?
-
Critically, the current JS implementation is broken/wrong, because it uses punycode.js without nameprep.
The RFC specifically says:
Implementations of IDNA MUST fully implement Nameprep and Punycode; neither Nameprep nor Punycode
are optional.https://www.ietf.org/rfc/rfc3490.txt
See also Indicate nameprep support mathiasbynens/punycode.js#40.
In theory we could shell out to an npm package but dealing with npm from Scala.js is terrible.
https://www.npmjs.com/package/idna-uts46 -
Meanwhile, the JVM implementation is using JDK APIs that are based on IDNA 2003 which IIUC is deprecated in favor of IDNA 2008. We could add a dependency to icu4j.
-
Thoughts? Since nobody is complaining about the existing broken/deprecated implementations, do we care enough to do this right?