JSPM

punycode-convertor

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q42843F
  • License MIT

A robust and efficient JavaScript library for encoding and decoding Unicode text to and from Punycode. This package provides a comprehensive solution for handling Punycode transformations, essential for internationalized domain names (IDNs) and other applications requiring Unicode compatibility. With punycode-converter, developers can seamlessly convert entire domain names or individual text segments between Unicode and Punycode formats.

Package Exports

  • punycode-convertor
  • punycode-convertor/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (punycode-convertor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

punycode-convertor

Punycode-convertor is a JavaScript module designed for encoding and decoding internationalized domain names (IDNs) using the Punycode-convertor encoding scheme. Punycode-convertor allows Unicode characters to be represented using the ASCII character set supported by the Domain Name System (DNS).

Installation

npm install punycode-convertor

Features

  • Domain Name Conversion:
    • Convert from Unicode to Punycode, supporting internationalized domain names.
    • Convert from Punycode to Unicode, supporting internationalized domain names.

Usage

The Punycode-convertor module provides straightforward functions to handle the conversion of domain names between Unicode and Punycode formats. Below are detailed examples illustrating how to use these functions in your JavaScript applications.

Converting Domain Names

Unicode to Punycode

const { unicodeToPunycode } = require('./punycode-convertor');

let domain = 'münchen.de';
let punycodeDomain = unicodeToPunycode(domain);
console.log(punycodeDomain); // Outputs "xn--mnchen-3ya.de"

Punycode to Unicode

const { punycodeToUnicode } = require('./punycode-convertor');

let punycodeDomain = 'xn--mnchen-3ya.de';
let unicodeDomain = punycodeToUnicode(punycodeDomain);
console.log(unicodeDomain); // Outputs "münchen.de"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any improvements or find any bugs.