Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tr46

Package Overview
Dependencies
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tr46

An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing

  • 4.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53M
decreased by-26.3%
Maintainers
6
Weekly downloads
 
Created

What is tr46?

The tr46 npm package is a JavaScript implementation of the TR46 algorithm, which is used for processing internationalized domain names (IDNs) and internationalized email addresses. It provides functionality to convert Unicode strings to ASCII strings that conform to the IDNA (Internationalized Domain Names in Applications) standards, and vice versa. This is useful for applications that need to handle domain names containing non-ASCII characters.

What are tr46's main functionalities?

toASCII

Converts a Unicode domain name to an ASCII Compatible Encoding (ACE), following the IDNA standards. This is useful for domain name resolution in environments that only support ASCII.

const tr46 = require('tr46');
const result = tr46.toASCII('täst.com');
console.log(result); // 'xn--tst-qla.com'

toUnicode

Converts an ASCII Compatible Encoding (ACE) domain name back to its Unicode form. This is useful for displaying domain names to users in their native script.

const tr46 = require('tr46');
const result = tr46.toUnicode('xn--tst-qla.com');
console.log(result); // 'täst.com'

processing options

Provides additional processing options for toASCII and toUnicode functions, such as checking for proper use of hyphens, bidirectional characters, and joiners, as well as using STD3 ASCII rules and choosing between transitional or non-transitional processing.

const tr46 = require('tr46');
const result = tr46.toASCII('täst.com', {checkHyphens: true, checkBidi: true, checkJoiners: true, useSTD3ASCIIRules: true, processingOption: 'TRANSITIONAL'});
console.log(result); // 'xn--tst-qla.com'

Other packages similar to tr46

Keywords

FAQs

Package last updated on 25 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc