RTT wrote: >> Yes, that should work and is the bare minimum required for use >> in the demos. Though it cannot handle a possible BOM. >> > With a little trick and we just need to rewrite the create > constructor. > > unit UnicodeIniFile; > > interface > type > TMyUnicodeIniFile = class(TIniFile) > public > constructor Create(const aFileName: string); > end; > > implementation > uses Classes, sysutils, Inifiles; > > constructor TMyUnicodeIniFile.Create(const aFileName: string); > var f: TfileStream; > const UnicodeBOM: word = $FEFF; > begin > if not fileexists(aFileName) then > try > f.Write(UnicodeBOM, 2); > finally > f.Free; > end; > inherited; > end; > > end. > > The D2009 TInitFile already uses the WritePrivateProfileStringW and > GetPrivateProfileStringW versions of the functions, but only work if > the ini file already exists and is Unicode.
Surprise! That works indeed with UTF-16, however if there is a UTF-8 BOM and data I cannot read a string, have you tested with UTF-8 as well? -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be