Encoding encshiftjis = encoding.getencoding ("shift-jis"); intItemlen = Encshiftjis.getbytecount (strpara);
using System.Text; private void button1_Click (object sender, System.EventArgs e) {string strName = textBox2.Text; char [] cs = strName.ToCharArray (); string Hstr = null; for (int l = 0; l < CS.LENGTH; L ) {HSTR = (INT) CS [L]). Tostring ("x");} textBox3.text = HSTR; hstr = null; Byte [] Bytstr = Encoding.ascii.Getbytes (Strname ); Foreach (Byte B in Bytstr) {HSTR = B.TOString ();} TextBox4.text = HSTR;} Convert Chinese to Bytes [] BYTES [] Barr = Encoding.utf-8.GetBytes (Scontent); // Traditional BYTES [] Barr = Encoding.Getencoding ("GB18030"). GetBytes // Simplified Bytes [] converted to specific Chinese String Scontent = Encoding.utf-8.getstring (Barr); // Traditional String Scontent = Encoding.Getencoding ("GB18030"). getString (Barr); // Simplified as other encodings, you can view the help of function encoding.getencoding