Thanks for the patch.

I notice that libcpp/charset.cc defines a function convert_utf8_utf16
(albeit currently static).  Is there a way that this could be reused,
rather than adding a 2nd implementation?

From what I can tell, it calls libiconv, which can't be assumed to be present. So despite not being ideal, it's necessary to reimplement it. It is also not that much code, not the worst thing.


[...snip...]

Sorry, I confess I don't know enough about Windows compat that I can't
comment on the rest of the patch.  If it fixes things on Windows and
doesn't break other OSes, that's good, I suppose :/

The problem is that windows support for utf8 is nonexistent until windows 10, and quite poor afterwards.
By default, even fopen cannot open a utf8 filename!
The only way to do this before windows 10 is calling the W windows APIs, which take utf-16.
https://nullprogram.com/blog/2021/12/30/
This blog post should clarify it if you care to research further. I don't think you need to.

It is behind an ifdef, so it cannot break any other platforms.


Hope this is constructive
Dave

Thanks for reviewing.

Reply via email to