]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - utf8lib.h
cbuf: catch runaway command loops, respects -norunaway cmdline arg
[xonotic/darkplaces.git] / utf8lib.h
index f54547764981b299f3419b028540d16853461746..b50a20655c8ce3ce1790dd6a1f81b9dec85b0a3f 100644 (file)
--- a/utf8lib.h
+++ b/utf8lib.h
@@ -1,3 +1,23 @@
+/*
+Copyright (C) 2009-2020 DarkPlaces contributors
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
 /*
  * UTF-8 utility functions for DarkPlaces
  */
@@ -58,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__