title: Which encoding is the C# equivalent to this java code? "Charles Okwuagwu".getBytes();
body: <p>say I have this code in Java: <code>"Charles Okwuagwu".getBytes();</code></p>
  
  <p>in c# this is simply <code>Encoding.UTF8.GetBytes("Charles Okwuagwu");</code></p>
  
  <p>My question is this: 
  1)Java uses UTF16 for strings
  2)the sting content is basically just ASCII</p>
  
  <p>Wouldn't it be equivalent in c# to simply use <code>Encoding.ASCII.GetBytes("Charles Okwuagwu");</code> ?</p>
  
  <p><strong>EDIT</strong>
  I ran this little test in .net:</p>
  
  <pre><code>Console.WriteLine("Default:{0}", B2H(Text.Encoding.Default.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("ASCII:{0}", B2H(Text.Encoding.ASCII.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("BigEndianUnicode:{0}", B2H(Text.Encoding.BigEndianUnicode.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("Unicode:{0}", B2H(Text.Encoding.Unicode.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("UTF32:{0}", B2H(Text.Encoding.UTF32.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("UTF7:{0}", B2H(Text.Encoding.UTF7.GetBytes("Charles Okwuagwu")))
  Console.WriteLine("UTF8:{0}", B2H(Text.Encoding.UTF8.GetBytes("Charles Okwuagwu")))
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>Default:436861726C6573204F6B777561677775
  ASCII:436861726C6573204F6B777561677775
  BigEndianUnicode:0043006800610072006C006500730020004F006B007700750061006700770075
  Unicode:43006800610072006C006500730020004F006B00770075006100670077007500
  UTF32:430000006800000061000000720000006C0000006500000073000000200000004F0000006B000000770000007500000061000000670000007700000075000000
  UTF7:436861726C6573204F6B777561677775
  UTF8:436861726C6573204F6B777561677775
  </code></pre>
  
  <p>it would seem UTF8,UTF7,ASCII give the same bytes. but Java strings default to UTF16 ...</p>