title: c# text to int64 representation
body: <p>I'm trying to convert the <code>string</code> <code>"Eureka"</code> into its UTF-8 <code>Int64</code> representation.</p>
  
  <p>I'm trying the following code :</p>
  
  <pre><code>  string message = "Eureka"; // if I use "Eureka\0\0" it works...
    byte[] bytes = System.Text.Encoding.UTF8.GetBytes(message);
  
    // this fails because I have 6 bytes, not 8 (as required for Int64)
    Int64 m = BitConverter.ToInt64(bytes, 0); 
  
    byte[] decodeBites = BitConverter.GetBytes(m);
  
    string decodeMessage = System.Text.Encoding.UTF8.GetString(decodeBites);
  
    if (!decodeMessage.Equals(message)) {
      Console.WriteLine("Message mis-match!!!");
    }
  </code></pre>
  
  <p>Now, because my string is too short, I don't have the right number of bytes and it fails. If I add 2 chars, it works, but then I don't have the desired string in <code>decodeMessage</code>... Pretty sure I need some conversion trick to remove the trailing "0" bytes after the conversion, but none of my attempts work. Any help would be much appreciated!!</p>
  
  <p><strong>UPDATE</strong>
  The goal is REALLY to have the integer representation of "Euraka", not "Eureka\0\0" then trim at the end.... The goals is to use the RSA-method on the obtained <code>Int64</code>, so at the other end, people won't know they have to trim anything...!</p>