summaryrefslogtreecommitdiff
path: root/src/node_i18n.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_i18n.h')
-rw-r--r--src/node_i18n.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/node_i18n.h b/src/node_i18n.h
index cc1f3e6ea5..adf9feb414 100644
--- a/src/node_i18n.h
+++ b/src/node_i18n.h
@@ -37,10 +37,26 @@ namespace i18n {
bool InitializeICUDirectory(const std::string& path);
+enum idna_mode {
+ // Default mode for maximum compatibility.
+ IDNA_DEFAULT,
+ // Ignore all errors in IDNA conversion, if possible.
+ IDNA_LENIENT,
+ // Enforce STD3 rules (UseSTD3ASCIIRules) and DNS length restrictions
+ // (VerifyDnsLength). Corresponds to `beStrict` flag in the "domain to ASCII"
+ // algorithm.
+ IDNA_STRICT
+};
+
+// Implements the WHATWG URL Standard "domain to ASCII" algorithm.
+// https://url.spec.whatwg.org/#concept-domain-to-ascii
int32_t ToASCII(MaybeStackBuffer<char>* buf,
const char* input,
size_t length,
- bool lenient = false);
+ enum idna_mode mode = IDNA_DEFAULT);
+
+// Implements the WHATWG URL Standard "domain to Unicode" algorithm.
+// https://url.spec.whatwg.org/#concept-domain-to-unicode
int32_t ToUnicode(MaybeStackBuffer<char>* buf,
const char* input,
size_t length);