X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=utf8lib.h;h=b50a20655c8ce3ce1790dd6a1f81b9dec85b0a3f;hb=86401a55abf8aa5bab83820146bd7154e077630a;hp=4b8221f5f779da6d7ca6d9103c6a69173acb08fa;hpb=f847004b9818defbfd4bf15fe7b891fee2706079;p=xonotic%2Fdarkplaces.git diff --git a/utf8lib.h b/utf8lib.h index 4b8221f5..b50a2065 100644 --- a/utf8lib.h +++ b/utf8lib.h @@ -78,4 +78,17 @@ extern Uchar u8_quake2utf8map[256]; Uchar u8_toupper(Uchar ch); Uchar u8_tolower(Uchar ch); +#ifdef WIN32 + +// WTF-8 encoding to circumvent Windows encodings, be it UTF-16 or random codepages +// https://simonsapin.github.io/wtf-8/ +#define WTF8U32 0 // whether to regard wchar as utf-32 +#define WTF8CHECKS 1 // check for extra sanity in conversion steps +typedef wchar_t wchar; + +int towtf8(const wchar* wstr, int wlen, char* cstr, int maxclen); +int fromwtf8(const char* cstr, int clen, wchar* wstr, int maxwlen); + +#endif // WIN32 + #endif // UTF8LIB_H__