d-mozulyov/UniConv

Convert to UFT8 without BOM...

mlcvista opened this issue · 3 comments

Hello,

Is it possible to convert an Ainsi Text file to UFT8 without BOM, with UniConv ?

Big thank you for your great UniConv.

With Best Rehgards,
Michel

Hello,

Sure it is possible
You should initialize TUniConvContext-instance with UTF8<--SBCS(Ansi) encodings, and call Convert function
Look FileConversion.dpr demo

You can also use CachedTexts library: https://github.com/d-mozulyov/CachedTexts
It has automatically conversion classes
It should be something like that:

Reader := TByteTextReader.CreateFromFile(CODEPAGE_UTF8, FileName);
while (not Reader.EOF) do
begin
  Stream.Write(Reader.Current^, Reader.Margin);
  Reader.Skip(Margin);
  Reader.Flush;
end;

Big thank you for your help, I'll test your solution.

Hope it will be useful for you :)