I have a question:
Some libraries use WCHAR as the text parameter and others use CHAR (as UTF-8): I need to know when to use WCHAR or CHAR when I write my own library.
Use char
and treat it as UTF-8. There are a great many reasons for this; this website summarises it much better than I can:
It recommends converting from wchar_t
to char
(UTF-16 to UTF-8) as soon as you receive it from any library, and converting back when you need to pass strings to it. So to answer your question, always use char
except at the point that an API requires you to pass or receive wchar_t
.