Skip to content

Instantly share code, notes, and snippets.



Created Jan 30, 2012
What would you like to do?
Round Tripping UTF-8
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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment