public
Created

Round Tripping UTF-8

  • Download Gist
utf-rt.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
using System;
using System.Text;
 
class Program
{
static void Main(string[] args)
{
var data = new byte[] { 128 };
string text = Encoding.UTF8.GetString(data);
var bytes = Encoding.UTF8.GetBytes(text);
 
Console.WriteLine("Original:\t" + String.Join(", ", data));
Console.WriteLine("Round Tripped:\t" + String.Join(", ", bytes));
 
Console.ReadKey();
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.