title: Wrong Unicode conversion, how to store accent characters in Delphi 2010 source code and handle character sets?
body: <p>We are upgrading our project from Delphi 2006 to Delphi 2010. Old code was:</p>
  
  <pre><code>InputText: string;
  InputText := SomeTEditComponent.Text;
  ...
  for i := 1 to length(InputText) do
  if InputText[i] in ['0'..'9', 'a'..'z', 'Ř' { and more special characters } ] then ...
  </code></pre>
  
  <p>Trouble is with accent letters - compare will fail.</p>
  
  <p>I tried switch source code from ANSI to UTF8 and LE UCS-2 but without luck. Only cast as AnsiChar works:</p>
  
  <pre><code>if CharInSet(AnsiChar(InputText[i]), ['0'..'9', 'a'..'z', 'Ř']) then
  </code></pre>
  
  <p>Funny is how Delphi works with that letters - try this in Evaluate during debugging:</p>
  
  <pre><code>Ord('Ř') = Ord('Ø')
  </code></pre>
  
  <p>(yes, Delphi says True, on Windows 7 Czech)</p>
  
  <hr>
  
  <p>Question is: How can I store and compare simple strings without forcing them as AnsiStrings? Because if this is not working why we should use Unicode?</p>
  
  <h2>Thanks all for reply</h2>
  
  <p>Right now we are using in some parts simple CharInSet(AnsiChar(...</p>