R: Encode or Decode Internationalised Domains

puny_encode {urltools} | R Documentation

## Encode or Decode Internationalised Domains

### Description

`puny_encode` and `puny_decode` implement the encoding standard for internationalised (non-ASCII) domains and subdomains. You can use them to encode UTF-8 domain names, or decode encoded names (which start "xn–"), or both.

### Usage

    puny_encode(x)

    puny_decode(x)

### Arguments

`x` | a vector of URLs. These should be URL decoded using `url_decode`.

### Value

a CharacterVector containing encoded or decoded versions of the entries in `x`. Invalid URLs (ones that are `NA`, or ones that do not successfully map to an actual decoded or encoded version) will be returned as `NA`.

### See Also

`url_decode` and `url_encode` for percent-encoding.

### Examples

    # Encode a URL
    puny_encode("https://www.bücher.com/foo")

    # Decode the result, back to the original
    puny_decode("https://www.xn--bcher-kva.com/foo")

[Package urltools version 1.7.3 Index]