[fpc-pascal] Adding file to string to the RTL
Bart
bartjunk64 at gmail.com
Tue Oct 6 19:21:34 CEST 2020
On Tue, Oct 6, 2020 at 10:12 AM Michael Van Canneyt via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
> // Assume TEncoding.SystemEncoding
> Function GetFileAsString(Const aFileName : RawByteString) : RawByteString;
> // Specify encoding
> Function GetFileAsString(Const aFileName : RawByteString; aEncoding : TEncoding) : RawByteString;
> // Assume TEncoding.Unicode contents
> Function GetFileAsString(Const aFileName : UnicodeString) : UnicodeString;
> // Specify encoding, return Unicode string.
> Function GetFileAsString(Const aFileName : UnicodeString; aEncoding : TEncoding) : UnicodeString;
Now I want to get the contents of a file, which contains either UTF8
or some single-byte encoding, and the filename is NOT in my locale
(e.g. it may be chinese, which I cannot represent in RawByteString),
but when I specify the filename as UnicodeString I am forced to
receive the contents Unicode as well.
>From my perspective that sucks.
--
Bart
More information about the fpc-pascal
mailing list