I have a delphi 7 form:
and my code:
when I run this form in Windows 7, I see:
In design time, form had polish letters in first label, but it doesn't have them in runtime. It looks ok on Vista or Windows XP. When I set caption of second label in code, everything works fine and characters are properly encoded.
First 5 codes of top label on Windows 7: 65 97 69 101 83
First 5 codes of top label on Windows Vista/XP: 165 185 202 234 140
First 5 codes of bottom label on every system: 165 185 202 234 140
Windows 7 changes encoding, why? My system settings seem to be ok. I have proper language set for non-unicode applications in control panel.
EDIT
This problem is not only related with labels on forms, but also with FastReport (where switching to EASTERN_CHARSET resolves the problem) or with accesing Microsoft Excel through COM interface.
Answers to this question solve my problem:
GetThreadLocale returns different value than GetUserDefaultLCID?
One solution:
The strange thing we found is that switching to a different regional settings via Control Panel and then switching back to NZ resolves the issue. I'd be curious to know if the same workaround resolves it for you just to verify that we're seeing the same phenomenon.
and second:
initialization
SetThreadLocale(LOCALE_USER_DEFAULT);
GetFormatSettings;
Both solutions work great and problem with application disappears.