I have a Delphi 7 application. I need to be able to get the default Windows character set for non-unicode programs. I know DEFAULT_CHARSET sets it, but I need to know exactly which charset it is, so that I could compare it to other character sets. Is this possible and how?
Thanks!
GetFontData is calling GetObject and using LogFont.lfCharSet to determine the charset
GetObject called with HFONT will fill LogFont Definition here is
DEFAULT_CHARSET is set to a value based on the current system locale. For example, when the system locale is English (United States), it is set as ANSI_CHARSET.
GetCPInfoEx with CP_ACP delivering a CPINFOEX structure will deliver the system default Windows ANSI code page.
var
CPInfoEx:TCPInfoEx;
CD:Cardinal;
CharsetInfo:TCharSetInfo;
CSN:String;
begin
If GetCPInfoEx(CP_ACP,0,CPInfoEx) then
begin
CD := CPInfoEx.Codepage;
if TranslateCharsetInfo(CD,CharsetInfo,TCI_SRCCODEPAGE) then
begin
CharsetToIdent(CharsetInfo.ciCharset,CSN);
Showmessage(CPInfoEx.CodePageName+' - '+IntToStr(CharsetInfo.ciCharset)+' - '+CSN);
end;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With