> If you derive something like the TMemInFile that writes all data in
> one call to a method UpdateFile it's possible to add a BOM or not 
> depending on the data itself. You can read a BOM-marked UTF-8 INI +
> file, change it and write it back as Ansi or plain Ascii without BOM
> if encoding is no longer required.
>   
For the simple use in the ICS demos this simple class is sufficient and 
backward compatibility with early Delphi  versions is simple as adding 
{$IFDEF UNICODE} to the override functions.

 TMyUnicodeIniFile = class(TIniFile)
 private
 fIsUTF8:Boolean;
 public
 {$IFDEF UNICODE}
   function ReadString(const Section, Ident, Default: string): string; 
override;
   procedure WriteString(const Section, Ident, Value: String); override;
   constructor Create(const aFileName: string);
 {$ENDIF}
 end;

In old Delphi versions use regular ini files, in D2009 check for the BOM 
presence, and when creating new ini file, add the BOM.
Old Delphi saved ini files will open correctly in D2009 compiled demo too.

In what situation you need to convert these files from code?
-- 
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

Reply via email to