Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Bart via fpc-devel
On Thu, Jan 2, 2020 at 7:15 PM Ondrej Pokorny wrote: > Should be fixed in r43839. Please report any issues. That was quick! Thanks. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Ondrej Pokorny
On 02.01.2020 14:58, Michael Van Canneyt wrote: On Thu, 2 Jan 2020, Bart via fpc-devel wrote: On Thu, Jan 2, 2020 at 12:12 PM Michael Van Canneyt wrote: In Delphi it doesn't matter where the encoding comes from. If writeBOM is true and there is a preamble for the encoding (whatever it

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Michael Van Canneyt
On Thu, 2 Jan 2020, Bart via fpc-devel wrote: On Thu, Jan 2, 2020 at 12:12 PM Michael Van Canneyt wrote: In Delphi it doesn't matter where the encoding comes from. If writeBOM is true and there is a preamble for the encoding (whatever it is), it is used. I think I have to rephrase my

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Bart via fpc-devel
On Thu, Jan 2, 2020 at 12:12 PM Michael Van Canneyt wrote: > In Delphi it doesn't matter where the encoding comes from. > If writeBOM is true and there is a preamble for the encoding (whatever it > is), it is used. I think I have to rephrase my question. In fpc TStrings.SaveToStream(AStream)

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Michael Van Canneyt
On Thu, 2 Jan 2020, Bart via fpc-devel wrote: On Wed, Jan 1, 2020 at 1:00 PM Bart wrote: Meanwhile, can anybody who has a recent Delphi version comment on this: B.t.w. Am I correct in understanding that when TStrings.SaveTo*() without an encoding parameter (so, the 1 parameter version)

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Bart via fpc-devel
On Wed, Jan 1, 2020 at 1:00 PM Bart wrote: Meanwhile, can anybody who has a recent Delphi version comment on this: > B.t.w. Am I correct in understanding that when TStrings.SaveTo*() > without an encoding parameter (so, the 1 parameter version) will NOT > write the BOM if Encoding = nil,

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Bart via fpc-devel
On Thu, Jan 2, 2020 at 12:36 AM Ozz Nixon via fpc-devel wrote: > Just make your own descendent - jeez. That is noy going to solve my problem. An addition like suggested would have made adjusting code inside Lazarus a bit easier. There are a multitude of TStrings descendants there, I would have

Re: [fpc-devel] TStrings and BOM

2020-01-02 Thread Bart via fpc-devel
On Thu, Jan 2, 2020 at 1:07 AM Ondrej Pokorny wrote: > But still adding an overload just to omit one line for changing some > property is nonsense. You can do so in a class helper if you want. I did not even consider that option. May indeed be the better choice. -- Bart

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'); //

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

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 > >

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'); //

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

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

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

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

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

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

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

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

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.

Re: [fpc-devel] TStrings and BOM

2019-12-31 Thread Michael Van Canneyt
On Tue, 31 Dec 2019, Bart via fpc-devel wrote: Hi, Would introducing a overload of TStrings.SaveTo* with a 3rd parameter to controle the writing of the BOM be acceptable? Reason: convenience: Fpc 3.2 introduces 2 new behaviours of TStrings: Encoding and WriteBom. For those of us who are