Node.js Punycode

What is Punycode

Punycode is an encoding syntax which is utilized to change over Unicode (UTF-8) series of characters to essential ASCII series of characters. Since host names just comprehend ASCII characters so Punycode is utilized. It is utilized as an internationalized space name (IDN or IDNA). We should comprehend it with an example:

Assume on the off chance that you look for mañana.com in your program so your program (which is IDNA empowered) first believer this to punycode xn- - maana-pta.com in light of the fact that the character ñ isn't permitted in ordinary space name. It isn't upheld in more seasoned adaptations.

Punycode in Node.js

Punycode.js is packaged with Node.js v0.6.2 and later forms. In the event that you need to utilize it with different Node.js renditions, at that point use npm to introduce punycode module first. You need to utilize require ('punycode') to get to it.


  1. punycode = require('punycode');  

  1. punycode = require('punycode');  


It is used to convert a Punycode string of ASCII symbols to a string of Unicode symbols.

File: punycode_example1.js

  1. punycode = require('punycode');  
  2. console.log(punycode.decode('maana-pta'));   


Node.js punycode example 1


It is used to convert a string of Unicode symbols to a Punycode string of ASCII symbols.

welookups is optimized for learning.© welookups. 2018 - 2020 All Right Reserved and you agree to have read and accepted our term and condition.