Extended ASCII characters displayed as ? (question mark)
<p>I have a form with a bunch of flags (static images) and below each flag is a tick box. The user selects the tick box to allow them to use a particular language. At design-time, I've set the checkbox captions for each language in their localised equivalent, in this example "Español" (Spanish).</p>

<p><a href="https://i.stack.imgur.com/fHsaG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fHsaG.png" alt="Design-time Spanish image and checkbox"></a></p>

<p>For nearly every language this is displayed just fine at runtime, but for a couple of languages this changes to "Espa?ol". Specifically, this happens when I select Lithuanian and use:</p>

<pre><code>// Note: 1063 = ((SUBLANG_DEFAULT shl 10) or LANG_LITHUANIAN)
SetThreadLocale(1063);
</code></pre>

<p><a href="https://i.stack.imgur.com/pbxNH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pbxNH.png" alt="Spanish text at runtime (without modification)"></a></p>

<p>Curiously, if I simply re-apply the caption with the following line in the form's OnShow handler, then it displays correctly as "Español".</p>

<pre><code>tbLangSpanish.Caption := 'Español';  // Strange, it now corrects itself!
</code></pre>

<p>The above code might be improved slightly by checking to see whether the runtime caption has a "?" character in it and only then re-apply the caption. The rest of the application displays Lithuanian perfectly (with labels being set at runtime).</p>

<p>Note that "ñ" is extended ASCII code 241. This issue affects a couple of other extended characters such as "ç" (character 231) in "Français". Of interest is that some extended ASCII characters are displayed correctly eg. "¾" (character 190).</p>

<p>Is this a bug in the IDE (using Delphi 7) or just a fact-of-life with legacy ASCII (ie. non-UNICODE) characters? Is there a prefered way to detect incompatible design-time extended ASCII characters at runtime (perhaps based on locale)?</p>

<p>None of the searches I performed gave any explanation about why a character would display as "?". I'm assuming this is because the requested character must be missing from the current Windows codepage, but no reference I could find explicitly says what is displayed when this happens (nor how to overcome the problem if you cannot use UNICODE).</p>