6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Macの濁点や半濁点を変換する(C#)

Last updated at Posted at 2015-12-28

Macのファイル名とかは、濁点・半濁点が不自然になっています。
それはUTF8-MacとかNFDとかと呼ばれているらしいです。
C#では、以下のメソッドを使って通常の表記(NFC)に変換することができたり、NFCかを判定することができるみたいです。

プログラム

NFCに変換:

var converted = "ぱぴぷぺぽパピプペポ".Normalize();

NFCかどうかを判定:

var isNfc = "ぱぴぷぺぽパピプペポ".IsNormalized();

NormalizationForm 列挙体

上述のようなNFDからNFCへ変換ばかりでなく、NormalizationForm 列挙体を使えばNFDへの変換やNFDかの判定が行えるようです。

参考文献

6
7
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
6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?