c#中文gbk编码查询示例代码

c#中文gbk编码查询示例,大家参考使用吧

复制代码 代码如下:

private void button_Inquriy_Click(object sender, EventArgs e)
 {
     if (textBox_Inquiry.TextLength > 0)
     {
         String strInquiry = textBox_Inquiry.Text;
         byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(strInquiry);
         String strResult = String.Empty;
         foreach (byte b in bytes)
         {
             strResult += b.ToString("X2");
             strResult += " ";
         }
         textBox_Result.Text = strResult;
     }
     else
     {
         MessageBox.Show("请输入待查询的字符");
     }
 }

以上就是c#中文gbk编码查询示例代码的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程