On Tue, 6 Oct 2020, Ryan Joseph via fpc-pascal wrote:
On Oct 6, 2020, at 2:12 AM, Michael Van Canneyt via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
I added the following functions to the sysutils unit (rev 47056):
Great, thanks Michael.
I've always used AnsiString so why is UnicodeString preferable here?
If the original file contains UTF16, it will save you a conversion.
I usually do not use UTF16, you clearly also not, but other people do,
and we try to cater for them as well :-)
So is the idea we need to specify an UTF-8 encoding for unicode otherwise
it assumes ASCII format?
It will assume the system unit default encoding. What that is depends on your
OS.
Mac, Linux: UTF8, windows: ANSI, unless you use Lazarus in which case it
will also be UTF8.
(in fact you can set it to any codepage you want, but the above are the
defaults)
I didn't specify the encoding with TStringList
and I always seemed to get back what I wanted (maybe it sniffed the
encoding from the file?).
Depending on your environment TStringList will use ANSI or UTF8, just as
above.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal