From: Matthew Mondor Date: Fri, 15 Apr 2022 18:58:22 +0000 (-0400) Subject: textutils: encode to UTF-8 before sending to the application. X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=62f3dde458b7862cf35b551011dd4a7a74982cfa;p=xscreensaver-5.35.git textutils: encode to UTF-8 before sending to the application. This allows to pass Latin-1, etc. Dead accents support still lacking. --- diff --git a/utils/textclient.c b/utils/textclient.c index d18edcc..8f4db2f 100644 --- a/utils/textclient.c +++ b/utils/textclient.c @@ -24,6 +24,7 @@ #include #include "utils.h" +#include "utf8wc.h" #if !defined(USE_IPHONE) && !defined(HAVE_ANDROID) /* whole file */ @@ -911,8 +912,15 @@ send: c |= 0x80; } - fputc (c, d->pipe); - fflush (d->pipe); + /* Encode to unicode UTF-8 and send */ + { + char utf[8]; + int sz; + + sz = utf8_encode(c, utf, 7); + (void)fwrite(utf, sz, 1, d->pipe); + (void)fflush(d->pipe); + } k->type = 0; /* don't interpret this event defaultly. */ # ifdef DEBUG