zoukankan      html  css  js  c++  java
  • System.Text.Encoding.UTF8 字符串和字节数组的互相转换


    /*--===------------------------------------------===--
    so lang to write code , now i'm free to code again,ha.
    this time, let's see a demo, Encoding.
    xuminghui, 2008-05-14 @home
    --===------------------------------------------===---
    */


    namespace xumh
    {
        
    public class EncodingTest
        
    {
            
    public static void Main()
            
    {
                System.Console.Write(
    "Input String, test Encoding:");
                
    string input = System.Console.ReadLine();
                
    //here, get the Byte Array of the String
                byte[] encodeBytes = System.Text.Encoding.UTF8.GetBytes(input);
                System.Console.WriteLine(
    "Encoding Bytes:{0}",System.BitConverter.ToString(encodeBytes));
                
    //here, get the String of the Bytes
                string gets = System.Text.Encoding.UTF8.GetString(encodeBytes);
                System.Console.WriteLine(
    "Encoding String:{0}",gets);
                System.Console.ReadLine();
            }

        }

    }
  • 相关阅读:
    AOP面向切面编程基础
    记第一次年会主持
    Tomcat服务器部署JavaWeb项目War包基本步骤
    VM14无法将网络更改为桥接状态:没有未桥接的主机网络适配器
    Ubuntu 16.04 安装 IDEA
    Linux之文件挂载
    图片大小
    打开文件、
    Setup Factory
    Repeater获取某一行TextBox值
  • 原文地址:https://www.cnblogs.com/flaaash/p/1197265.html
Copyright © 2011-2022 走看看