Author: Jonas Bilinkevicius How to get the local charset of a system Answer: 1 2 function TranslateCharsetInfoEx(lpSrc: PDWORD; var lpCs: TCharsetInfo; 3 dwFlags: DWORD): BOOL; stdcall; external 'gdi32.dll' name 'TranslateCharsetInfo'; 4 5 procedure SetLocaleCharset; 6 var 7 LCID, CP: Cardinal; 8 Buf: array[0..6] of Char; 9 CSI: TCharsetInfo; 10 begin 11 LCID := GetThreadLocale; 12 GetLocaleInfo(LCID, LOCALE_IDefaultAnsiCodePage, Buf, 6); 13 CP := StrToIntDef(Buf, GetACP); 14 TranslateCharsetInfoEx(Pointer(CP), CSI, TCI_SRCCODEPAGE); 15 LocaleCharSet := CSI.ciCharset; 16 end;