private void button6_Click(object sender, EventArgs e) { System.IO.FileStream fs = new System.IO.FileStream( "jis2ucs.bin", System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] bs = new byte[fs.Length]; long fsize=fs.Length; fs.Read(bs, 0, bs.Length); fs.Close(); int i = 0; //int unicp = 0; int jiscp = 0; //string uni = ""; byte[] bb = new byte[2]; int[] unicp = new int[0x10000]; string[] uni = new string[0x10000]; System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (i = 0; i * 2 < fsize; i++) { jiscp = i; unicp[i] = BitConverter.ToUInt16(bs, i * 2); bb = BitConverter.GetBytes(unicp[i]); uni[i] = System.Text.Encoding.GetEncoding(1200).GetString(bb); uni[i] = uni[i].Replace("\x0", ""); uni[i] = uni[i].Replace("\xd", ""); if (unicp[i] != 0 && i > 0) { sb.Append("0x"); sb.Append(jiscp.ToString("X")); sb.Append("\tU+"); sb.Append(unicp[i].ToString("X")); sb.Append("\t#"); sb.AppendLine(uni[i]); } } System.IO.StreamWriter sw = new System.IO.StreamWriter("jis2ucs.txt",false,System.Text.Encoding.GetEncoding(65001)); sw.Write(sb.ToString()); sw.Close(); sb.Clear(); string th = ""; string tf = "
"; string tst = ""; string tend = ""; string th1 = ""; string th2 = ""; string td1 = ""; string td2 = ""; int c1 = 0; int c2 = 0; sb.AppendLine(th); sb.AppendLine(Properties.Resources.tuni); for (i = 0; i < 0x10000; i++) { c1 = i >> 8; c2 = i & 0xff; if(i< 0x100 || (c1>=0x21 && c2>=0x20 && c1<=0x7f &&c2<= 0x7f)){ if ((i & 0xF) == 0) { sb.AppendLine(tst); sb.Append(th1); sb.Append(i.ToString("X")); sb.AppendLine(th2); sb.Append(td1); sb.Append(uni[i]); sb.AppendLine(td2); } else { sb.Append(td1); sb.Append(uni[i]); sb.AppendLine(td2); if ((i & 0xf) == 0xf) { sb.AppendLine(tend); } } } } System.IO.StreamWriter sww = new System.IO.StreamWriter("jis2ucs.html", false, System.Text.Encoding.GetEncoding(65001)); sww.Write(sb.ToString()); sww.Close(); }