Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Werner Pamler
Am 02.01.2020 um 00:51 schrieb Ondrej Pokorny: The WriteBOM property has a valid purpose - it is set in LoadFrom* according to the BOM presence in the loaded file. I.e. if you do: MyStrings.LoadFromFile('abc'); // WriteBOM and Encoding properties are set here MyStrings.SaveToFile('abc'); // they

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Dmitry Boyarintsev via fpc-devel
On Wed, Jan 1, 2020 at 6:51 PM Ondrej Pokorny wrote: > If you want to simplify a call, use a class helper: > > TStringsHelper = class helper for TStrings > ... > procedure TStringsHelper.SaveToFileWithBOM(aFileName: string); > begin >WriteBOM := True; >SaveToFile(aFileName); > end; > a b

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Dmitry Boyarintsev via fpc-devel
On Wed, Jan 1, 2020 at 7:07 PM Ondrej Pokorny wrote: > > The WriteBOM property has a valid purpose - it is set in LoadFrom* > > according to the BOM presence in the loaded file. I.e. if you do: > > > > MyStrings.LoadFromFile('abc'); // WriteBOM and Encoding properties are > > set here > > MyStrin

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Werner Pamler
Am 02.01.2020 um 00:51 schrieb Ondrej Pokorny: The WriteBOM property has a valid purpose - it is set in LoadFrom* according to the BOM presence in the loaded file. I.e. if you do: MyStrings.LoadFromFile('abc'); // WriteBOM and Encoding properties are set here MyStrings.SaveToFile('abc'); // th

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Ondrej Pokorny
On 02.01.2020 0:51, Ondrej Pokorny wrote: On 01.01.2020 23:59, Werner Pamler wrote: Am 01.01.2020 um 17:01 schrieb Ondrej Pokorny: Isn't the TStrings.WriteBOM property good enough? Why to have yet another not-very-useful overload? To be honest I think Bart's idea of making the BOM an optional

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Ondrej Pokorny
On 01.01.2020 23:59, Werner Pamler wrote: Am 01.01.2020 um 17:01 schrieb Ondrej Pokorny: Isn't the TStrings.WriteBOM property good enough? Why to have yet another not-very-useful overload? To be honest I think Bart's idea of making the BOM an optional parameter of the Save methods appears to

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Bart via fpc-devel
On Thu, Jan 2, 2020 at 12:02 AM Werner Pamler wrote: > To be honest I think Bart's idea of making the BOM an optional parameter > of the Save methods appears to me more efficient than defining a > property just for this only purpose. Do we really have to imitate all > the nonsense dictated by Del

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Ozz Nixon via fpc-devel
Just make your own descendent - jeez. On Wed, Jan 1, 2020 at 5:02 PM Werner Pamler wrote: > Am 01.01.2020 um 17:01 schrieb Ondrej Pokorny: > > Isn't the TStrings.WriteBOM property good enough? Why to have yet > > another not-very-useful overload? > > To be honest I think Bart's idea of making th

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Werner Pamler
Am 01.01.2020 um 17:01 schrieb Ondrej Pokorny: Isn't the TStrings.WriteBOM property good enough? Why to have yet another not-very-useful overload? To be honest I think Bart's idea of making the BOM an optional parameter of the Save methods appears to me more efficient than defining a property

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Bart via fpc-devel
On Wed, Jan 1, 2020 at 9:56 PM Ondrej Pokorny wrote: > You replace the WriteBOM property with the AWriteBOM parameter. What's the > point of it? What do you plan to do with the WriteBOM property then? I quote myself (from my fiirst post): > SaveToStream(Fn, TEncoding.UTF8, False) is a one line

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Ondrej Pokorny
On 01.01.2020 13:00, Bart via fpc-devel wrote: On Wed, Jan 1, 2020 at 12:25 PM Bart wrote: By all means, patches welcome. Patch attached. For completeness I could implement also SaveToStream(AStream, AWriteBom) and SaveToFile(FileName, AWriteBom). // code begin // -Procedure TStrings.SaveTo

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Ondrej Pokorny
On 31.12.2019 18:37, Michael Van Canneyt wrote: On Tue, 31 Dec 2019, Bart via fpc-devel wrote: Would introducing a overload of TStrings.SaveTo* with a 3rd parameter to controle the writing of the BOM be acceptable? By all means, patches welcome. Isn't the TStrings.WriteBOM property good enou

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Bart via fpc-devel
On Wed, Jan 1, 2020 at 12:25 PM Bart wrote: > > By all means, patches welcome. Patch attached. For completeness I could implement also SaveToStream(AStream, AWriteBom) and SaveToFile(FileName, AWriteBom). B.t.w. Am I correct in understanding that when TStrinsg.SaveTo*() without an encoding para

Re: [fpc-devel] TStrings and BOM

2020-01-01 Thread Bart via fpc-devel
On Tue, Dec 31, 2019 at 6:37 PM Michael Van Canneyt wrote: > By all means, patches welcome. I can provide a patch for that. If the patch were to be accepted, would it go into 3.2.0? (Otherwise, see my argument for implementing it, it's hardly worth bothering.) PS. Happy New Year to all of you.