Tomas-
Thanks for pursuing this! Generally a good approach.
I do not like item 3 in that the function, as described, is named DetectUtfBom
but does more than detect. Side effects of functions are generally not good. I
would at least rename it something like DetectAndHandleUtfBom.
But to fully correct the situation, I would also change it to a procedure since
leaving it as a function still suggests it only returns a result and has no
other side effects.
Doug C.
---- On Sun, 15 Sep 2019 18:20:22 -0400 Tomas Hajny <xhaj...@hajny.biz> wrote
----
3) New function 'DetectUtfBom (var T: text): boolean' will be added.
This function may be called after the call to 'Reset (T: text)' to check
for existence of BOM at the beginning of the text file. If it is found
(Result=true), SetTextCodePage is invoked automatically from
DetectUtfBom with the codepage value corresponding to the found BOM and
encoding variant. If BOM is not found (Result=false), nothing changes.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal