title: Delphi: How to get the *real* ASCII code from a string
body: <p>This is driving me crazy. I have been two days converting my string from one type to another with no success.</p>
  
  <p>I'm using Delphi Rio and I need to convert a string to HEX or DEC, but the string contains special characters, like á é í ó ú ñ or €.</p>
  
  <p>For example, the 'á' character is 160 (dec) or A0 (hex).
  However, I'm getting 225, 145, 241 depending on the string type (ansichar, utf8, widechar...) but I don't know how can I get the real 160 value.</p>
  
  <p>I need this because I want to send special characters to a bluetooth printer.
  If I send this:</p>
  
  <pre><code>edit1.text := 'áéíóú€$';
  FSocket.SendData(TEncoding.ASCII.GetBytes(edit1.Text));
  </code></pre>
  
  <p>Printer receives this (HEX):</p>
  
  <pre><code>3F 3F 3F 3F 3F 3F 24
  </code></pre>
  
  <p>However, it should receive this (HEX):</p>
  
  <pre><code>A0 82 A1 A2 A3 D5 24
  </code></pre>
  
  <p>That's because I'm getting the wrong ASCII value for each character (63 is the ascii code for '?' character).</p>
  
  <p>So... how can I send the real ASCII text to the printer?
  How can I get the real ascii code for 'á' (160)?</p>
  
  <p>Please help!</p>