this.textBox1.Text = "";
if ((this.textBox2.Text != null) && (this.textBox2.Text.Trim() != ""))
{
string text1 = this.textBox2.Text;
byte[] buffer1 = Form1.unicode.GetBytes(text1);
for (int num1 = 1; num1 < buffer1.Length; num1 += 2)
{
this.textBox1.Text = this.textBox1.Text + @"\u";
this.textBox1.Text = this.textBox1.Text + Uri.HexEscape(Convert.ToChar(buffer1[num1])).Substring(1, 2);
this.textBox1.Text = this.textBox1.Text + Uri.HexEscape(Convert.ToChar(buffer1[num1 - 1])).Substring(1, 2);
}
}//textbox1保存的是中文对应的unicode字符,textbox2用来输入你要转换的汉字
if ((this.textBox2.Text != null) && (this.textBox2.Text.Trim() != ""))
{
string text1 = this.textBox2.Text;
byte[] buffer1 = Form1.unicode.GetBytes(text1);
for (int num1 = 1; num1 < buffer1.Length; num1 += 2)
{
this.textBox1.Text = this.textBox1.Text + @"\u";
this.textBox1.Text = this.textBox1.Text + Uri.HexEscape(Convert.ToChar(buffer1[num1])).Substring(1, 2);
this.textBox1.Text = this.textBox1.Text + Uri.HexEscape(Convert.ToChar(buffer1[num1 - 1])).Substring(1, 2);
}
}//textbox1保存的是中文对应的unicode字符,textbox2用来输入你要转换的汉字
byte[] buffer1 =System.Text.Encoding.Unicode.GetType();
还有错哦,怎么解决呢?
2个TextBox