aboutsummaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc/RFBGlue.cc
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-03-18 13:53:26 +0100
committerPierre Ossman <ossman@cendio.se>2023-06-30 21:39:44 +0200
commitc061a78dc1f7242cfcaf42049d5248e4eed39ff4 (patch)
tree6126e1d9944e1cc3208514eb3369a8b7f3d45759 /unix/xserver/hw/vnc/RFBGlue.cc
parent19df176862ff0687cabc435056061a1b6cbe9ff2 (diff)
downloadtigervnc-c061a78dc1f7242cfcaf42049d5248e4eed39ff4.tar.gz
tigervnc-c061a78dc1f7242cfcaf42049d5248e4eed39ff4.zip
Clean up string encoding handling
We should handle this in the low-level protocol code as much as possible to avoid mistakes. This way the rest of the code can assume that strings are always UTF-8 with \n line endings.
Diffstat (limited to 'unix/xserver/hw/vnc/RFBGlue.cc')
-rw-r--r--unix/xserver/hw/vnc/RFBGlue.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
index 2fbc27ee..25431b65 100644
--- a/unix/xserver/hw/vnc/RFBGlue.cc
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
@@ -248,3 +248,12 @@ char* vncUTF8ToLatin1(const char* src, size_t bytes)
return NULL;
}
}
+
+int vncIsValidUTF8(const char* str, size_t bytes)
+{
+ try {
+ return isValidUTF8(str, bytes);
+ } catch (...) {
+ return 0;
+ }
+}