[Ttssh2-commit] [8547] About TTSSH ダイアログの文字化けを修正

scmno****@osdn***** scmno****@osdn*****
2020年 2月 20日 (木) 00:20:34 JST


Revision: 8547
          https://osdn.net/projects/ttssh2/scm/svn/commits/8547
Author:   zmatsuo
Date:     2020-02-20 00:20:34 +0900 (Thu, 20 Feb 2020)
Log Message:
-----------
About TTSSH ダイアログの文字化けを修正

- UTF-8ベースで文字列を処理
- UTIL_get_lang_msgU8() を追加、GetI18nStrU8() を使用
- GetI18nStrU8() を i18n.c から i18n_static.c に分離
  - GetI18nStrU8() は export されていない i18n.c の関数だった
- cmake, VS2005, VS2019

Modified Paths:
--------------
    trunk/teraterm/common/i18n.c
    trunk/ttssh2/ttxssh/CMakeLists.txt
    trunk/ttssh2/ttxssh/auth.c
    trunk/ttssh2/ttxssh/crypt.c
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj
    trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj.filters
    trunk/ttssh2/ttxssh/ttxssh.vcproj
    trunk/ttssh2/ttxssh/util.c
    trunk/ttssh2/ttxssh/util.h

Added Paths:
-----------
    trunk/teraterm/common/i18n_static.c

-------------- next part --------------
Modified: trunk/teraterm/common/i18n.c
===================================================================
--- trunk/teraterm/common/i18n.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/teraterm/common/i18n.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -84,34 +84,6 @@
 	RestoreNewLine(buf);
 }
 
-// TODO: \x83o\x83b\x83t\x83@\x95s\x91\xAB\x8E\x9E\x82̓\xAE\x8D\xEC
-void GetI18nStrU8(const char *section, const char *key, char *buf, int buf_len, const char *def, const char *iniFile)
-{
-	size_t r;
-	if (pGetPrivateProfileStringW != NULL) {
-		// unicode base
-		wchar_t tmp[MAX_UIMSG];
-		wchar_t defW[MAX_UIMSG];
-		r = UTF8ToWideChar(def, -1, defW, _countof(defW));
-		assert(r != 0);
-		GetI18nStrW(section, key, tmp, _countof(tmp), defW, iniFile);
-		r = buf_len;
-		WideCharToUTF8(tmp, NULL, buf, &r);
-		assert(r != 0);
-	}
-	else {
-		// ANSI -> Wide -> utf8
-		char strA[MAX_UIMSG];
-		wchar_t strW[MAX_UIMSG];
-		GetI18nStr(section, key, strA, _countof(strA), def, iniFile);
-		r = MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, _countof(strW));
-		assert(r != 0);
-		r = buf_len;
-		WideCharToUTF8(strW, NULL, buf, &r);
-		assert(r != 0);
-	}
-}
-
 int WINAPI GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile)
 {
 	char tmp[MAX_UIMSG];

Added: trunk/teraterm/common/i18n_static.c
===================================================================
--- trunk/teraterm/common/i18n_static.c	                        (rev 0)
+++ trunk/teraterm/common/i18n_static.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2020 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "i18n.h"
+#include "codeconv.h"
+#include "compat_win.h"
+
+#include <assert.h>
+
+// TODO: \x83o\x83b\x83t\x83@\x95s\x91\xAB\x8E\x9E\x82̓\xAE\x8D\xEC
+void GetI18nStrU8(const char *section, const char *key, char *buf, int buf_len, const char *def, const char *iniFile)
+{
+	size_t r;
+	if (pGetPrivateProfileStringW != NULL) {
+		// unicode base
+		wchar_t tmp[MAX_UIMSG];
+		wchar_t defW[MAX_UIMSG];
+		r = UTF8ToWideChar(def, -1, defW, _countof(defW));
+		assert(r != 0);
+		GetI18nStrW(section, key, tmp, _countof(tmp), defW, iniFile);
+		r = buf_len;
+		WideCharToUTF8(tmp, NULL, buf, &r);
+		assert(r != 0);
+	}
+	else {
+		// ANSI -> Wide -> utf8
+		char strA[MAX_UIMSG];
+		wchar_t strW[MAX_UIMSG];
+		GetI18nStr(section, key, strA, _countof(strA), def, iniFile);
+		r = MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, _countof(strW));
+		assert(r != 0);
+		r = buf_len;
+		WideCharToUTF8(strW, NULL, buf, &r);
+		assert(r != 0);
+	}
+}
+
+/* vim: set ts=4 sw=4 ff=dos : */

Modified: trunk/ttssh2/ttxssh/CMakeLists.txt
===================================================================
--- trunk/ttssh2/ttxssh/CMakeLists.txt	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/CMakeLists.txt	2020-02-19 15:20:34 UTC (rev 8547)
@@ -87,6 +87,7 @@
   ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
   ../../teraterm/common/ttcommon.h
   ../../teraterm/common/i18n.h
+  ../../teraterm/common/i18n_static.c
   ../../teraterm/common/ttlib.h
   ../../teraterm/common/ttlib.c
   ../../teraterm/common/dlglib.h

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/auth.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -1736,19 +1736,19 @@
 		strncpy_s(dest, len, "None", _TRUNCATE);
 	} else if (pvar->auth_state.cur_cred.method != SSH_AUTH_NONE) {
 		if (SSHv1(pvar)) {
-			UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
+			UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
 			_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->auth_state.user,
 			            get_auth_method_name(pvar->auth_state.cur_cred.method));
 
 			if (pvar->auth_state.cur_cred.method == SSH_AUTH_RSA) {
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
 				_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 				            "RSA");
 				strncat_s(dest, len, buf, _TRUNCATE);
 			}
 			else if (pvar->auth_state.cur_cred.method == SSH_AUTH_PAGEANT) {
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
 				_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 				            "RSA");
 				strncat_s(dest, len, buf, _TRUNCATE);
@@ -1764,18 +1764,18 @@
 				} else {
 					method = get_auth_method_name(pvar->auth_state.cur_cred.method);
 				}
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
 				_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 				            pvar->auth_state.user, method);
 			}
 			else if (pvar->auth_state.cur_cred.method == SSH_AUTH_RSA) {
 				method = get_auth_method_name(pvar->auth_state.cur_cred.method);
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
 				_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 				            pvar->auth_state.user,
 				            get_auth_method_name(pvar->auth_state.cur_cred.method));
 
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
 				_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 				            ssh_key_type(pvar->auth_state.cur_cred.key_pair->type));
 				strncat_s(dest, len, buf, _TRUNCATE);
@@ -1785,7 +1785,7 @@
 				char *s = (char *)malloc(key_len+1);
 
 				method = get_auth_method_name(pvar->auth_state.cur_cred.method);
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
 				_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 				            pvar->auth_state.user,
 				            get_auth_method_name(pvar->auth_state.cur_cred.method));
@@ -1792,7 +1792,7 @@
 
 				memcpy(s, pvar->pageant_curkey+4+4, key_len);
 				s[key_len] = '\0';
-				UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
+				UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
 				_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 				            ssh_key_type(get_keytype_from_name(s)));
 				strncat_s(dest, len, buf, _TRUNCATE);
@@ -1802,7 +1802,7 @@
 		}
 
 	} else {
-		UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
+		UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
 		_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg, pvar->auth_state.user,
 		            get_auth_method_name(pvar->auth_state.failed_method));
 	}

Modified: trunk/ttssh2/ttxssh/crypt.c
===================================================================
--- trunk/ttssh2/ttxssh/crypt.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/crypt.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -1329,8 +1329,8 @@
 
 void CRYPT_get_cipher_info(PTInstVar pvar, char *dest, int len)
 {
-	UTIL_get_lang_msg("DLG_ABOUT_CIPHER_INFO", pvar,
-	                  "%s to server, %s from server");
+	UTIL_get_lang_msgU8("DLG_ABOUT_CIPHER_INFO", pvar,
+						"%s to server, %s from server");
 	_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 	          get_cipher_name(pvar->crypt_state.sender_cipher),
 	          get_cipher_name(pvar->crypt_state.receiver_cipher));
@@ -1346,21 +1346,21 @@
 	if (SSHv1(pvar)) {
 		if (pvar->crypt_state.server_key.RSA_key == NULL
 		 || pvar->crypt_state.host_key.RSA_key == NULL) {
-			UTIL_get_lang_msg("DLG_ABOUT_KEY_NONE", pvar, "None");
+			UTIL_get_lang_msgU8("DLG_ABOUT_KEY_NONE", pvar, "None");
 			strncpy_s(dest, len, pvar->ts->UIMsg, _TRUNCATE);
 		} else {
 			RSA_get0_key(pvar->crypt_state.server_key.RSA_key, &server_n, NULL, NULL);
 			RSA_get0_key(pvar->crypt_state.host_key.RSA_key, &host_n, NULL, NULL);
 
-			UTIL_get_lang_msg("DLG_ABOUT_KEY_INFO", pvar,
-			                  "%d-bit server key, %d-bit host key");
+			UTIL_get_lang_msgU8("DLG_ABOUT_KEY_INFO", pvar,
+								"%d-bit server key, %d-bit host key");
 			_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 			            BN_num_bits(server_n),
 			            BN_num_bits(host_n));
 		}
 	} else { // SSH2
-			UTIL_get_lang_msg("DLG_ABOUT_KEY_INFO2", pvar,
-			                  "%d-bit client key, %d-bit server key");
+			UTIL_get_lang_msgU8("DLG_ABOUT_KEY_INFO2", pvar,
+								"%d-bit client key, %d-bit server key");
 			_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->client_key_bits,
 			            pvar->server_key_bits);

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/ssh.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -3408,19 +3408,19 @@
 			pvar->ssh_state.compress_stream.total_out;
 
 		if (total_out > 0) {
-			UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO", pvar,
-			                  "level %d; ratio %.1f (%ld:%ld)");
+			UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO", pvar,
+								"level %d; ratio %.1f (%ld:%ld)");
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->ssh_state.compression_level,
 			            ((double) total_in) / total_out, total_in,
 			            total_out);
 		} else {
-			UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
+			UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->ssh_state.compression_level);
 		}
 	} else {
-		UTIL_get_lang_msg("DLG_ABOUT_COMP_NONE", pvar, "none");
+		UTIL_get_lang_msgU8("DLG_ABOUT_COMP_NONE", pvar, "none");
 		strncpy_s(buf, sizeof(buf), pvar->ts->UIMsg, _TRUNCATE);
 	}
 
@@ -3434,24 +3434,24 @@
 			pvar->ssh_state.decompress_stream.total_out;
 
 		if (total_in > 0) {
-			UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO", pvar,
-			                  "level %d; ratio %.1f (%ld:%ld)");
+			UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO", pvar,
+								"level %d; ratio %.1f (%ld:%ld)");
 			_snprintf_s(buf2, sizeof(buf2), _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->ssh_state.compression_level,
 			            ((double) total_out) / total_in, total_out,
 			            total_in);
 		} else {
-			UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
+			UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
 			_snprintf_s(buf2, sizeof(buf2), _TRUNCATE, pvar->ts->UIMsg,
 			            pvar->ssh_state.compression_level);
 		}
 	} else {
-		UTIL_get_lang_msg("DLG_ABOUT_COMP_NONE", pvar, "none");
+		UTIL_get_lang_msgU8("DLG_ABOUT_COMP_NONE", pvar, "none");
 		strncpy_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 	}
 
-	UTIL_get_lang_msg("DLG_ABOUT_COMP_UPDOWN", pvar,
-	                  "Upstream %s; Downstream %s");
+	UTIL_get_lang_msgU8("DLG_ABOUT_COMP_UPDOWN", pvar,
+						"Upstream %s; Downstream %s");
 	_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg, buf, buf2);
 }
 
@@ -3476,8 +3476,8 @@
 
 void SSH_get_mac_info(PTInstVar pvar, char *dest, int len)
 {
-	UTIL_get_lang_msg("DLG_ABOUT_MAC_INFO", pvar,
-	                  "%s to server, %s from server");
+	UTIL_get_lang_msgU8("DLG_ABOUT_MAC_INFO", pvar,
+						"%s to server, %s from server");
 	_snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
 	            get_ssh2_mac_name(pvar->macs[MODE_OUT]),
 	            get_ssh2_mac_name(pvar->macs[MODE_IN]));

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -2225,7 +2225,7 @@
 		buf2[0] = '\0';
 
 		if (SSHv1(pvar)) {
-			UTIL_get_lang_msg("DLG_ABOUT_SERVERID", pvar, "Server ID:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_SERVERID", pvar, "Server ID:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_server_ID_info(pvar, buf, sizeof(buf));
@@ -2232,7 +2232,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_protocol_version_info(pvar, buf, sizeof(buf));
@@ -2239,7 +2239,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			CRYPT_get_cipher_info(pvar, buf, sizeof(buf));
@@ -2246,7 +2246,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_SERVERKEY", pvar, "Server keys:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_SERVERKEY", pvar, "Server keys:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			CRYPT_get_server_key_info(pvar, buf, sizeof(buf));
@@ -2253,7 +2253,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_AUTH", pvar, "Authentication:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_AUTH", pvar, "Authentication:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			AUTH_get_auth_info(pvar, buf, sizeof(buf));
@@ -2260,7 +2260,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_COMP", pvar, "Compression:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_COMP", pvar, "Compression:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_compression_info(pvar, buf, sizeof(buf));
@@ -2268,7 +2268,7 @@
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
 		} else { // SSH2
-			UTIL_get_lang_msg("DLG_ABOUT_SERVERID", pvar, "Server ID:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_SERVERID", pvar, "Server ID:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_server_ID_info(pvar, buf, sizeof(buf));
@@ -2275,13 +2275,13 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_CLIENTID", pvar, "Client ID:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_CLIENTID", pvar, "Client ID:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), pvar->client_version_string, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_protocol_version_info(pvar, buf, sizeof(buf));
@@ -2288,19 +2288,19 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_KEX", pvar, "Key exchange algorithm:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_KEX", pvar, "Key exchange algorithm:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), get_kex_algorithm_name(pvar->kex_type), _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_HOSTKEY", pvar, "Host Key:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_HOSTKEY", pvar, "Host Key:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), get_ssh_keytype_name(pvar->hostkey_type), _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			CRYPT_get_cipher_info(pvar, buf, sizeof(buf));
@@ -2307,7 +2307,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_MAC", pvar, "MAC algorithm:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_MAC", pvar, "MAC algorithm:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			SSH_get_mac_info(pvar, buf, sizeof(buf));
@@ -2315,10 +2315,10 @@
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
 			if (pvar->ctos_compression == COMP_DELAYED) { // \x92x\x89\x84\x83p\x83P\x83b\x83g\x88\xB3\x8Fk\x82̏ꍇ (2006.6.23 yutaka)
-				UTIL_get_lang_msg("DLG_ABOUT_COMPDELAY", pvar, "Delayed Compression:");
+				UTIL_get_lang_msgU8("DLG_ABOUT_COMPDELAY", pvar, "Delayed Compression:");
 			}
 			else {
-				UTIL_get_lang_msg("DLG_ABOUT_COMP", pvar, "Compression:");
+				UTIL_get_lang_msgU8("DLG_ABOUT_COMP", pvar, "Compression:");
 			}
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
@@ -2326,7 +2326,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_KEXKEY", pvar, "Key exchange keys:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_KEXKEY", pvar, "Key exchange keys:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			CRYPT_get_server_key_info(pvar, buf, sizeof(buf));
@@ -2333,7 +2333,7 @@
 			strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
-			UTIL_get_lang_msg("DLG_ABOUT_AUTH", pvar, "Authentication:");
+			UTIL_get_lang_msgU8("DLG_ABOUT_AUTH", pvar, "Authentication:");
 			strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 			strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
 			AUTH_get_auth_info(pvar, buf, sizeof(buf));
@@ -2343,7 +2343,7 @@
 
 		// \x83z\x83X\x83g\x8C\xF6\x8AJ\x8C\xAE\x82\xCCfingerprint\x82\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9\x81B
 		// (2014.5.1 yutaka)
-		UTIL_get_lang_msg("DLG_ABOUT_FINGERPRINT", pvar, "Host key's fingerprint:");
+		UTIL_get_lang_msgU8("DLG_ABOUT_FINGERPRINT", pvar, "Host key's fingerprint:");
 		strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
 		strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
 
@@ -2369,7 +2369,11 @@
 		strncat_s(buf2, sizeof(buf2), fp, _TRUNCATE);
 		free(fp);
 
-		SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETTEXT, 0, (LPARAM)(char *)buf2);
+		{
+			wchar_t *strW = ToWcharU8(buf2);
+			SetDlgItemTextW(dlg, IDC_ABOUTTEXT, strW);
+			free(strW);
+		}
 	}
 }
 

Modified: trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj	2020-02-19 15:20:34 UTC (rev 8547)
@@ -147,6 +147,7 @@
     <ClCompile Include="..\..\teraterm\common\dlglib_cpp.cpp" />
     <ClCompile Include="..\..\teraterm\common\dlglib_tmpl.cpp" />
     <ClCompile Include="..\..\teraterm\common\dllutil.cpp" />
+    <ClCompile Include="..\..\teraterm\common\i18n_static.c" />
     <ClCompile Include="..\..\teraterm\common\layer_for_unicode.cpp" />
     <ClCompile Include="..\..\teraterm\common\tipwin.cpp" />
     <ClCompile Include="..\..\teraterm\common\ttlib.c" />
@@ -242,4 +243,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file

Modified: trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj.filters
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj.filters	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/ttxssh.v16.vcxproj.filters	2020-02-19 15:20:34 UTC (rev 8547)
@@ -242,4 +242,4 @@
       <Filter>Def File</Filter>
     </None>
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file

Modified: trunk/ttssh2/ttxssh/ttxssh.vcproj
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.vcproj	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/ttxssh.vcproj	2020-02-19 15:20:34 UTC (rev 8547)
@@ -448,6 +448,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\teraterm\common\i18n_static.c"
+				>
+			</File>
+			<File
 				RelativePath="kex.c"
 				>
 			</File>

Modified: trunk/ttssh2/ttxssh/util.c
===================================================================
--- trunk/ttssh2/ttxssh/util.c	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/util.c	2020-02-19 15:20:34 UTC (rev 8547)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998-2001, Robert O'Callahan
- * (C) 2004-2019 TeraTerm Project
+ * (C) 2004-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -320,6 +320,12 @@
 		def, pvar->ts->UILanguageFile);
 }
 
+void UTIL_get_lang_msgU8(const char *key, PTInstVar pvar, const char *def)
+{
+	const char *UILanguageFile = pvar->ts->UILanguageFile;
+	GetI18nStrU8("TTSSH", key, pvar->ts->UIMsg, MAX_UIMSG, def, UILanguageFile);
+}
+
 /*
  *	\x93\x99\x95\x9D\x83t\x83H\x83\x93\x83g\x82\xF0\x8E擾
  *	@retval		\x83t\x83H\x83\x93\x83g\x83n\x83\x93\x83h\x83\x8B

Modified: trunk/ttssh2/ttxssh/util.h
===================================================================
--- trunk/ttssh2/ttxssh/util.h	2020-02-18 16:50:50 UTC (rev 8546)
+++ trunk/ttssh2/ttxssh/util.h	2020-02-19 15:20:34 UTC (rev 8547)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998-2001, Robert O'Callahan
- * (C) 2004-2019 TeraTerm Project
+ * (C) 2004-2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,7 @@
 BOOL UTIL_is_sock_deeply_buffered(UTILSockWriteBuf *buf);
 
 void UTIL_get_lang_msg(const char *key, PTInstVar pvar, const char *def);
+void UTIL_get_lang_msgU8(const char *key, PTInstVar pvar, const char *def);
 HFONT UTIL_get_lang_fixedfont(HWND hWnd, const char *UILanguageFile);
 
 #endif


Ttssh2-commit メーリングリストの案内