[fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file
XHajT03 at hajny.biz
Mon Sep 16 09:05:50 CEST 2019
On 2019-09-16 08:29, LacaK wrote:
> Thank you Tomas.
> My comment per function names: use pattern SetText.../GetText...
> So for inspiration:
> - GetTextBOM or ReadBOM(var T: Text; SetCodePage:boolean=True):Word,
> (parameter SetCodePage should specify if SetTextCodePage will be
> called automatically if desired). Retunr value will be CP_NONE (no
> BOM) or CP_UTF8, CP_UTF16,...
> - SetTextBOM or WriteBOM(var T: Text; CodePage: Word)
> (writtes BOM corresponding to given CodePage and will call
> SetTextCodePage). Boolean BOM parameter is IMO not needed as call to
> this function signals, that user wants write BOM else user will call
> SetTextCodePage() only
Yes, GetTextBOM/SetTextBOM as described above make sense, good idea.
Just to be clear - I don't have capacity to work on the implementation
myself, your potential contribution would be appreciated. I'm ready to
review and hopefully incorporate your implementation to trunk.
More information about the fpc-pascal