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<string, string> conv1, Func<string, string> 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]));
}
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uR2xvYmFsaXphdGlvbjsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CgogICAgICAgICAgICB2YXIgY3VsdHVyZSA9IEN1bHR1cmVJbmZvLkdldEN1bHR1cmVJbmZvKCJqYS1KUCIpOwoKICAgICAgICAgICAgdGhpcy50ZXh0Qm94MS5BcHBlbmRUZXh0KCLlsI/mloflrZctPuWkp+aWh+Wtl+OBrumghuOBq+WkieaPm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ICAgICAgICBpZiAocyAhPSBjMiAmJiBzICE9IGMxKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHRleHRCb3gxLkFwcGVuZFRleHQoc3RyaW5nLkZvcm1hdCgi5YWD44Gu5paH5a2XOnswfShVK3sxOlg0fSktPnsyfShVK3szOlg0fSktPns0fShVK3s1Olg0fSlcclxuIiwgcywgKGludClzWzBdLCBjMSwgKGludCljMVswXSwgYzIsIChpbnQpYzJbMF0pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQo=