On Thu, Jan 2, 2020 at 12:12 PM Michael Van Canneyt <mich...@freepascal.org> 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) does NOT use DefaultEncoding if Encoding is nil. So this code: //Source codepage is Windows 1512 SL := TStringList.Create; SL.SkipLastLineBreak := True; SL.WriteBOM := True; SL.DefaultEncoding := TEncoding.UTF8; S := 'รค'; // = #$0E SL.Add(S); SL.SaveToStream(St) Will result in St having as content 1 single byte: 0E (hex) Whereas SL.SaveToStream(St, nil) will result in St having a content of 5 bytes: EF BB BF C3 A4 Is that Delphi compatible? From the help text of the Embarcadero site I cannot figure that out. -- Bart _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel