Skip to contents

Determines whether a domain name contains Unicode characters that would require punycode encoding for ASCII compatibility.

Usage

is_idn(x)

Arguments

x

Character vector of domain names to test

Value

A logical vector the same length as x, where TRUE indicates the element contains non-ASCII Unicode characters. Never NA and never an error: an element that is not well-formed UTF-8 is reported as FALSE, matching is_punycode and base R's own validUTF8. Use validUTF8(x) to tell "not internationalized" apart from "not well-formed text".

See also

is_punycode for detecting punycode domains, puny_encode for encoding Unicode domains.

Examples

is_idn("caf\u00E9.com") # TRUE
#> [1] TRUE
is_idn("example.com") # FALSE
#> [1] FALSE
is_idn(c(
  "caf\u00E9.com",
  "\u043C\u043E\u0441\u043A\u0432\u0430.\u0440\u0444",
  "test.com"
)) # c(TRUE, TRUE, FALSE)
#> [1]  TRUE  TRUE FALSE