Did you look at the iconv API? Mike
On Sun, Nov 29, 2020, 18:34 Greg Keogh <gfke...@gmail.com> wrote: > Some of you may remember learning C, and somewhere around page 4 of your > textbook you learn how to use *fopen*, *fgets *and *fclose *to loop and > read the string lines out of a file. But times have changed... > > Does anyone know how to do the same thing for a utf-8 file that may or may > not have a BOM? > > I've been reading, searching and experimenting for a solid hour, and I > simply cannot figure out how to do that. Some people have samples that read > every byte and get "lines" and manually convert them between different > encodings, but I can't seriously believe that complexity is necessary in > the 21st century. In .NET we just go string s = file.ReadLine() and it > just works no matter what type of file encoding is being read. That makes > us lucky and lazy, so I'm wondering if there is anything as convenient in > the standard C/C++ libraries. I can't find anything so far, and I'm not > optimistic. > > *Greg K* >