– 코드: class Class1 { /// <summary> /// 해당 응용 프로그램의 주 진입점입니다. /// </summary> [STAThread] static void Main(string[] args) { // // TODO: 여기에 응용 프로그램을 시작하는 코드를 추가합니다. // string tmp = “한글English”; byte []bArray_ =Encoding.Default.GetBytes(tmp); Console.Out.WriteLine(Encoding.Default.EncodingName); Console.Out.WriteLine(Encoding.Default.GetString(bArray_)); Console.Out.WriteLine(bArray_.Length); byte []u7Array_ = Encoding.Convert(Encoding.Default, Encoding.UTF7, bArray_); Console.Out.WriteLine(Encoding.UTF7.EncodingName); Console.Out.WriteLine(Encoding.UTF7.GetString(u7Array_)); Console.Out.WriteLine(u7Array_.Length); byte []u8Array_ = Encoding.Convert(Encoding.Default, Encoding.UTF8, bArray_); Console.Out.WriteLine(Encoding.UTF8.EncodingName); Console.Out.WriteLine(Encoding.UTF8.GetString(u8Array_)); Console.Out.WriteLine(u8Array_.Length); byte []uArray_ = Encoding.Convert(Encoding.Default, Encoding.Unicode, bArray_); Console.Out.WriteLine(Encoding.Unicode.EncodingName); Console.Out.WriteLine(Encoding.Unicode.GetString(uArray_)); Console.Out.WriteLine(uArray_.Length); byte []aArray_ = Encoding.Convert(Encoding.Default, Encoding.ASCII, bArray_); Console.Out.WriteLine(Encoding.ASCII.EncodingName); Console.Out.WriteLine(Encoding.ASCII.GetString(aArray_)); Console.Out.WriteLine(aArray_.Length); } } ———————————————————————————– – 결과: 한국어 한글English 11 유니코드(UTF-7) 한글English 15 유니코드(UTF-8) 한글English 13 유니코드 한글English 18 US-ASCII ??English 9 |
Comments