Reputation: 1390
SearchRec: TSearchRec;
FindFirst
showmessage(SearchRec.Name);
FindNext(SearchRec);
FindClose(SearchRec);
The code works well.
When I redo all 4 steps with Vietnamese instead of Russian, the filename shown with showmessage is not correct. Some ?
appear instead (see the screenshot):
Please help
Upvotes: 0
Views: 1144
Reputation: 43033
This is due to the way Delphi versions prior to 2009 implements their string
type. It is not a problem of font, but a problem of character encoding.
All string
variables, and also all Windows API calls are performed using ANSI encoding. With ANSI, you can use only one code page at a time. In order to mix code pages (i.e. mix russian and vietnamese encodings), you'll need to process the text and call UNICODE Windows API.
Here is what occurred in your case:
So you have several workarounds:
string
will be UNICODE, so you will be able to mix character sets;widestring
for storing your text, and call directly the windows wide APIs - that is, you can't use the VCL units nor FindFirst/FindNext
as defined in SysUtils
, nor ShowMessage
as defined in Dialogs
.Of course, the first one is the easiest!
Upvotes: 1