2022-01-08 17:05:05 +00:00
# tr46
An JavaScript implementation of [Unicode Technical Standard #46: Unicode IDNA Compatibility Processing ](https://unicode.org/reports/tr46/ ).
## API
### `toASCII(domainName[, options])`
Converts a string of Unicode symbols to a case-folded Punycode string of ASCII symbols.
Available options:
2024-04-22 11:47:34 +00:00
* [`checkBidi` ](#checkbidi )
* [`checkHyphens` ](#checkhyphens )
* [`checkJoiners` ](#checkjoiners )
* [`ignoreInvalidPunycode` ](#ignoreinvalidpunycode )
* [`transitionalProcessing` ](#transitionalprocessing )
* [`useSTD3ASCIIRules` ](#usestd3asciirules )
* [`verifyDNSLength` ](#verifydnslength )
2022-01-08 17:05:05 +00:00
### `toUnicode(domainName[, options])`
Converts a case-folded Punycode string of ASCII symbols to a string of Unicode symbols.
Available options:
2024-04-22 11:47:34 +00:00
* [`checkBidi` ](#checkbidi )
* [`checkHyphens` ](#checkhyphens )
* [`checkJoiners` ](#checkjoiners )
* [`ignoreInvalidPunycode` ](#ignoreinvalidpunycode )
* [`transitionalProcessing` ](#transitionalprocessing )
* [`useSTD3ASCIIRules` ](#usestd3asciirules )
2022-01-08 17:05:05 +00:00
## Options
### `checkBidi`
2024-04-22 11:47:34 +00:00
Type: `boolean`
Default value: `false`
2022-01-08 17:05:05 +00:00
When set to `true` , any bi-directional text within the input will be checked for validation.
### `checkHyphens`
2024-04-22 11:47:34 +00:00
Type: `boolean`
Default value: `false`
2022-01-08 17:05:05 +00:00
When set to `true` , the positions of any hyphen characters within the input will be checked for validation.
### `checkJoiners`
2024-04-22 11:47:34 +00:00
Type: `boolean`
Default value: `false`
2022-01-08 17:05:05 +00:00
When set to `true` , any word joiner characters within the input will be checked for validation.
2024-04-22 11:47:34 +00:00
### `ignoreInvalidPunycode`
Type: `boolean`
Default value: `false`
When set to `true` , invalid Punycode strings within the input will be allowed.
### `transitionalProcessing`
Type: `boolean`
Default value: `false`
When set to `true` , uses [transitional (compatibility) processing ](https://unicode.org/reports/tr46/#Compatibility_Processing ) of the deviation characters.
2022-01-08 17:05:05 +00:00
### `useSTD3ASCIIRules`
2024-04-22 11:47:34 +00:00
Type: `boolean`
Default value: `false`
2022-01-08 17:05:05 +00:00
When set to `true` , input will be validated according to [STD3 Rules ](http://unicode.org/reports/tr46/#STD3_Rules ).
### `verifyDNSLength`
2024-04-22 11:47:34 +00:00
Type: `boolean`
Default value: `false`
2022-01-08 17:05:05 +00:00
When set to `true` , the length of each DNS label within the input will be checked for validation.