using System; using System.Globalization; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); var culture = CultureInfo.GetCultureInfo("ja-JP"); this.textBox1.AppendText("小文字->大文字の順に変換したら違う文字になったもの\r\n"); hoge(0x0000, 0xD7FF, (s) => s.ToLower(culture), (s) => s.ToUpper(culture)); hoge(0xE000, 0xFFFF, (s) => s.ToLower(culture), (s) => s.ToUpper(culture)); this.textBox1.AppendText("大文字->小文字の順に変換したら違う文字になったもの\r\n"); hoge(0x0000, 0xD7FF, (s) => s.ToUpper(culture), (s) => s.ToLower(culture)); hoge(0xE000, 0xFFFF, (s) => s.ToUpper(culture), (s) => s.ToLower(culture)); } void hoge(int start, int end, Func conv1, Func conv2) { for (int code = start; code <= end; code++) { var s = new string((char)code, 1); var c1 = conv1(s); var c2 = conv2(c1); if (s != c2 && s != c1) { textBox1.AppendText(string.Format("元の文字:{0}(U+{1:X4})->{2}(U+{3:X4})->{4}(U+{5:X4})\r\n", s, (int)s[0], c1, (int)c1[0], c2, (int)c2[0])); } } } } }