Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Michael Van Canneyt
On Fri, 10 Jan 2020, AlexeyT via fpc-pascal wrote:     ini_lexmap:= TIniFile.Create(fn_lexmap_final);     try   ini_lexmap.WriteString('ref', IntToStr(i_sub), s_lexer);     finally   FreeAndNil(ini_lexmap);     end; with FPC trunk it converts .ini file to UTF8

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
On Fri, Jan 10, 2020 at 11:30 PM AlexeyT via fpc-pascal wrote: > Can you add TIniFile.WriteBom property? it's not quite enough, I need to > disable it globally in entire app (I have ~10 ini objects), so > additional global default is needed (like Lazarus has global variables). Open a ticket in t

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread AlexeyT via fpc-pascal
Can you add TIniFile.WriteBom property? it's not quite enough, I need to disable it globally in entire app (I have ~10 ini objects), so additional global default is needed (like Lazarus has global variables). -- Regards, Alexey ___ fpc-pascal maillis

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread AlexeyT via fpc-pascal
>> 2) if BOM is there, allow ReadString to find section at the file begin: I can read/write IniFiles with BOM with fpc r43847, with and withoud DefautSystemCodePage := CP_UTF8. Sorry, my mistake-- TIniFile can read this BOM file, but my software cannot: a) I've fixed one place where my app re

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
On Fri, Jan 10, 2020 at 5:57 PM AlexeyT via fpc-pascal wrote: > 1) don't write BOM via WriteString It doesn't AFAICS. The BOM is written in UpdateFile. > 2) if BOM is there, allow ReadString to find section at the file begin: > BOMCHARS[ref] I can read/write IniFiles with BOM with fpc r43847,

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
TIniFile manually adds the BOM to the first Line. Then SaveToFile is called, which (if FEncoding = Utf8) will add the BOM again? Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pa

[fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread AlexeyT via fpc-pascal
    ini_lexmap:= TIniFile.Create(fn_lexmap_final);     try   ini_lexmap.WriteString('ref', IntToStr(i_sub), s_lexer);     finally   FreeAndNil(ini_lexmap);     end; with FPC trunk it converts .ini file to UTF8 BOM! Bad, because then my code reads this .ini file an