From 3336ac4605d9f78bfc48f37763a010530f11a6ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20=C3=85strand?= Date: Mon, 26 Jan 2009 13:35:31 +0000 Subject: [PATCH] Make sure both console and GUI about text is displayed correctly, even in UTF-8 environments. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3578 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/vncviewer/vncviewer.cxx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/unix/vncviewer/vncviewer.cxx b/unix/vncviewer/vncviewer.cxx index 007c425a..f39d8b8e 100644 --- a/unix/vncviewer/vncviewer.cxx +++ b/unix/vncviewer/vncviewer.cxx @@ -267,20 +267,27 @@ int main(int argc, char** argv) bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); - snprintf(aboutText, sizeof(aboutText), - _("TightVNC Viewer for X version %s - built %s\n" - "Copyright (C) 2002-2005 RealVNC Ltd.\n" - "Copyright (C) 2000-2006 TightVNC Group\n" - "Copyright (C) 2004-2005 Peter Astrand, Cendio AB\n" - "See http://www.tightvnc.com for information on TightVNC."), - PACKAGE_VERSION, buildtime); + const char englishAbout[] = N_("TightVNC Viewer for X version %s - built %s\n" + "Copyright (C) 2002-2005 RealVNC Ltd.\n" + "Copyright (C) 2000-2006 TightVNC Group\n" + "Copyright (C) 2004-2005 Peter Astrand, Cendio AB\n" + "See http://www.tightvnc.com for information on TightVNC."); + + // Write about text to console, still using normal locale codeset + snprintf(aboutText, sizeof(aboutText), + gettext(englishAbout), PACKAGE_VERSION, buildtime); fprintf(stderr,"\n%s\n", aboutText); + // Set gettext codeset to what our GUI toolkit uses. Since we are + // passing strings from strerror/gai_strerror to the GUI, these must + // be in GUI codeset as well. bind_textdomain_codeset(PACKAGE_NAME, "iso-8859-1"); - // Since we are passing strings from strerror/gai_strerror to the - // GUI, these must be in GUI codeset as well. bind_textdomain_codeset("libc", "iso-8859-1"); + // Re-create the aboutText for the GUI, now using GUI codeset + snprintf(aboutText, sizeof(aboutText), + gettext(englishAbout), PACKAGE_VERSION, buildtime); + rfb::initStdIOLoggers(); rfb::LogWriter::setLogParams("*:stderr:30"); -- 2.39.5