Add UTF-8 to/from ISO 8859-1 conversion routines
We convert between UTF-8 and ISO 8859-1 (latin 1) in several places
so create some common routines for this.
diff --git a/common/rfb/util.h b/common/rfb/util.h
index de09669..7bd5cc0 100644
--- a/common/rfb/util.h
+++ b/common/rfb/util.h
@@ -88,6 +88,15 @@
char* convertLF(const char* src, size_t bytes = (size_t)-1);
+ // Convertions between various Unicode formats. The returned strings are
+ // always null terminated and must be freed using strFree().
+
+ size_t ucs4ToUTF8(unsigned src, char* dst);
+ size_t utf8ToUCS4(const char* src, size_t max, unsigned* dst);
+
+ char* latin1ToUTF8(const char* src, size_t bytes = (size_t)-1);
+ char* utf8ToLatin1(const char* src, size_t bytes = (size_t)-1);
+
// HELPER functions for timeout handling
// soonestTimeout() is a function to help work out the soonest of several