LoginSignup
3
3

More than 5 years have passed since last update.

日本語ドメインについて

Last updated at Posted at 2015-07-02

日本語ドメインについて調べる機会があったのでメモ

日本語ドメインとは

広くは国際化ドメイン(IDN:Internationalized Domain Name)と呼ばれる。

エンコード/デコード

ASCIIとUnicodeの相互変換ができるようになっている。

  • Unicode : お名前.com
  • ASCII : xn--t8jx73hngb.com

ASCIIの方は、Punycode(ぴゅにこーど)と呼ばれる。

試してみる

scala> java.net.IDN.toASCII("お名前.com")
res1: String = xn--t8jx73hngb.com

scala> java.net.IDN.toUnicode("xn--t8jx73hngb.com")
res2: String = お名前.com

HTTPクライアントのDispatchで日本語ドメインは一度ASCIIに変換しないと上手く動作しなかったという背景がありますた。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3