• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8547 (tree)
Zeit2020-02-20 00:20:34
Autorzmatsuo

Log Message

About TTSSH ダイアログの文字化けを修正

- UTF-8ベースで文字列を処理
- UTIL_get_lang_msgU8() を追加、GetI18nStrU8() を使用
- GetI18nStrU8() を i18n.c から i18n_static.c に分離

- GetI18nStrU8() は export されていない i18n.c の関数だった

- cmake, VS2005, VS2019

Ändern Zusammenfassung

Diff

--- trunk/teraterm/common/i18n.c (revision 8546)
+++ trunk/teraterm/common/i18n.c (revision 8547)
@@ -84,34 +84,6 @@
8484 RestoreNewLine(buf);
8585 }
8686
87-// TODO: バッファ不足時の動作
88-void GetI18nStrU8(const char *section, const char *key, char *buf, int buf_len, const char *def, const char *iniFile)
89-{
90- size_t r;
91- if (pGetPrivateProfileStringW != NULL) {
92- // unicode base
93- wchar_t tmp[MAX_UIMSG];
94- wchar_t defW[MAX_UIMSG];
95- r = UTF8ToWideChar(def, -1, defW, _countof(defW));
96- assert(r != 0);
97- GetI18nStrW(section, key, tmp, _countof(tmp), defW, iniFile);
98- r = buf_len;
99- WideCharToUTF8(tmp, NULL, buf, &r);
100- assert(r != 0);
101- }
102- else {
103- // ANSI -> Wide -> utf8
104- char strA[MAX_UIMSG];
105- wchar_t strW[MAX_UIMSG];
106- GetI18nStr(section, key, strA, _countof(strA), def, iniFile);
107- r = MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, _countof(strW));
108- assert(r != 0);
109- r = buf_len;
110- WideCharToUTF8(strW, NULL, buf, &r);
111- assert(r != 0);
112- }
113-}
114-
11587 int WINAPI GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile)
11688 {
11789 char tmp[MAX_UIMSG];
--- trunk/teraterm/common/i18n_static.c (nonexistent)
+++ trunk/teraterm/common/i18n_static.c (revision 8547)
@@ -0,0 +1,63 @@
1+/*
2+ * Copyright (C) 2020 TeraTerm Project
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions
7+ * are met:
8+ *
9+ * 1. Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ * 2. Redistributions in binary form must reproduce the above copyright
12+ * notice, this list of conditions and the following disclaimer in the
13+ * documentation and/or other materials provided with the distribution.
14+ * 3. The name of the author may not be used to endorse or promote products
15+ * derived from this software without specific prior written permission.
16+ *
17+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+ */
28+
29+#include "i18n.h"
30+#include "codeconv.h"
31+#include "compat_win.h"
32+
33+#include <assert.h>
34+
35+// TODO: バッファ不足時の動作
36+void GetI18nStrU8(const char *section, const char *key, char *buf, int buf_len, const char *def, const char *iniFile)
37+{
38+ size_t r;
39+ if (pGetPrivateProfileStringW != NULL) {
40+ // unicode base
41+ wchar_t tmp[MAX_UIMSG];
42+ wchar_t defW[MAX_UIMSG];
43+ r = UTF8ToWideChar(def, -1, defW, _countof(defW));
44+ assert(r != 0);
45+ GetI18nStrW(section, key, tmp, _countof(tmp), defW, iniFile);
46+ r = buf_len;
47+ WideCharToUTF8(tmp, NULL, buf, &r);
48+ assert(r != 0);
49+ }
50+ else {
51+ // ANSI -> Wide -> utf8
52+ char strA[MAX_UIMSG];
53+ wchar_t strW[MAX_UIMSG];
54+ GetI18nStr(section, key, strA, _countof(strA), def, iniFile);
55+ r = MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, _countof(strW));
56+ assert(r != 0);
57+ r = buf_len;
58+ WideCharToUTF8(strW, NULL, buf, &r);
59+ assert(r != 0);
60+ }
61+}
62+
63+/* vim: set ts=4 sw=4 ff=dos : */
--- trunk/ttssh2/ttxssh/CMakeLists.txt (revision 8546)
+++ trunk/ttssh2/ttxssh/CMakeLists.txt (revision 8547)
@@ -87,6 +87,7 @@
8787 ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
8888 ../../teraterm/common/ttcommon.h
8989 ../../teraterm/common/i18n.h
90+ ../../teraterm/common/i18n_static.c
9091 ../../teraterm/common/ttlib.h
9192 ../../teraterm/common/ttlib.c
9293 ../../teraterm/common/dlglib.h
--- trunk/ttssh2/ttxssh/auth.c (revision 8546)
+++ trunk/ttssh2/ttxssh/auth.c (revision 8547)
@@ -1736,19 +1736,19 @@
17361736 strncpy_s(dest, len, "None", _TRUNCATE);
17371737 } else if (pvar->auth_state.cur_cred.method != SSH_AUTH_NONE) {
17381738 if (SSHv1(pvar)) {
1739- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
1739+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
17401740 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
17411741 pvar->auth_state.user,
17421742 get_auth_method_name(pvar->auth_state.cur_cred.method));
17431743
17441744 if (pvar->auth_state.cur_cred.method == SSH_AUTH_RSA) {
1745- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
1745+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
17461746 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
17471747 "RSA");
17481748 strncat_s(dest, len, buf, _TRUNCATE);
17491749 }
17501750 else if (pvar->auth_state.cur_cred.method == SSH_AUTH_PAGEANT) {
1751- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
1751+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
17521752 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
17531753 "RSA");
17541754 strncat_s(dest, len, buf, _TRUNCATE);
@@ -1764,18 +1764,18 @@
17641764 } else {
17651765 method = get_auth_method_name(pvar->auth_state.cur_cred.method);
17661766 }
1767- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
1767+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
17681768 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
17691769 pvar->auth_state.user, method);
17701770 }
17711771 else if (pvar->auth_state.cur_cred.method == SSH_AUTH_RSA) {
17721772 method = get_auth_method_name(pvar->auth_state.cur_cred.method);
1773- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
1773+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
17741774 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
17751775 pvar->auth_state.user,
17761776 get_auth_method_name(pvar->auth_state.cur_cred.method));
17771777
1778- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
1778+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO2", pvar, " with %s key");
17791779 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
17801780 ssh_key_type(pvar->auth_state.cur_cred.key_pair->type));
17811781 strncat_s(dest, len, buf, _TRUNCATE);
@@ -1785,7 +1785,7 @@
17851785 char *s = (char *)malloc(key_len+1);
17861786
17871787 method = get_auth_method_name(pvar->auth_state.cur_cred.method);
1788- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
1788+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
17891789 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
17901790 pvar->auth_state.user,
17911791 get_auth_method_name(pvar->auth_state.cur_cred.method));
@@ -1792,7 +1792,7 @@
17921792
17931793 memcpy(s, pvar->pageant_curkey+4+4, key_len);
17941794 s[key_len] = '\0';
1795- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
1795+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO3", pvar, " with %s key from Pageant");
17961796 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
17971797 ssh_key_type(get_keytype_from_name(s)));
17981798 strncat_s(dest, len, buf, _TRUNCATE);
@@ -1802,7 +1802,7 @@
18021802 }
18031803
18041804 } else {
1805- UTIL_get_lang_msg("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
1805+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH_INFO", pvar, "User '%s', using %s");
18061806 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg, pvar->auth_state.user,
18071807 get_auth_method_name(pvar->auth_state.failed_method));
18081808 }
--- trunk/ttssh2/ttxssh/crypt.c (revision 8546)
+++ trunk/ttssh2/ttxssh/crypt.c (revision 8547)
@@ -1329,8 +1329,8 @@
13291329
13301330 void CRYPT_get_cipher_info(PTInstVar pvar, char *dest, int len)
13311331 {
1332- UTIL_get_lang_msg("DLG_ABOUT_CIPHER_INFO", pvar,
1333- "%s to server, %s from server");
1332+ UTIL_get_lang_msgU8("DLG_ABOUT_CIPHER_INFO", pvar,
1333+ "%s to server, %s from server");
13341334 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
13351335 get_cipher_name(pvar->crypt_state.sender_cipher),
13361336 get_cipher_name(pvar->crypt_state.receiver_cipher));
@@ -1346,21 +1346,21 @@
13461346 if (SSHv1(pvar)) {
13471347 if (pvar->crypt_state.server_key.RSA_key == NULL
13481348 || pvar->crypt_state.host_key.RSA_key == NULL) {
1349- UTIL_get_lang_msg("DLG_ABOUT_KEY_NONE", pvar, "None");
1349+ UTIL_get_lang_msgU8("DLG_ABOUT_KEY_NONE", pvar, "None");
13501350 strncpy_s(dest, len, pvar->ts->UIMsg, _TRUNCATE);
13511351 } else {
13521352 RSA_get0_key(pvar->crypt_state.server_key.RSA_key, &server_n, NULL, NULL);
13531353 RSA_get0_key(pvar->crypt_state.host_key.RSA_key, &host_n, NULL, NULL);
13541354
1355- UTIL_get_lang_msg("DLG_ABOUT_KEY_INFO", pvar,
1356- "%d-bit server key, %d-bit host key");
1355+ UTIL_get_lang_msgU8("DLG_ABOUT_KEY_INFO", pvar,
1356+ "%d-bit server key, %d-bit host key");
13571357 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
13581358 BN_num_bits(server_n),
13591359 BN_num_bits(host_n));
13601360 }
13611361 } else { // SSH2
1362- UTIL_get_lang_msg("DLG_ABOUT_KEY_INFO2", pvar,
1363- "%d-bit client key, %d-bit server key");
1362+ UTIL_get_lang_msgU8("DLG_ABOUT_KEY_INFO2", pvar,
1363+ "%d-bit client key, %d-bit server key");
13641364 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
13651365 pvar->client_key_bits,
13661366 pvar->server_key_bits);
--- trunk/ttssh2/ttxssh/ssh.c (revision 8546)
+++ trunk/ttssh2/ttxssh/ssh.c (revision 8547)
@@ -3408,19 +3408,19 @@
34083408 pvar->ssh_state.compress_stream.total_out;
34093409
34103410 if (total_out > 0) {
3411- UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO", pvar,
3412- "level %d; ratio %.1f (%ld:%ld)");
3411+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO", pvar,
3412+ "level %d; ratio %.1f (%ld:%ld)");
34133413 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
34143414 pvar->ssh_state.compression_level,
34153415 ((double) total_in) / total_out, total_in,
34163416 total_out);
34173417 } else {
3418- UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
3418+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
34193419 _snprintf_s(buf, sizeof(buf), _TRUNCATE, pvar->ts->UIMsg,
34203420 pvar->ssh_state.compression_level);
34213421 }
34223422 } else {
3423- UTIL_get_lang_msg("DLG_ABOUT_COMP_NONE", pvar, "none");
3423+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_NONE", pvar, "none");
34243424 strncpy_s(buf, sizeof(buf), pvar->ts->UIMsg, _TRUNCATE);
34253425 }
34263426
@@ -3434,24 +3434,24 @@
34343434 pvar->ssh_state.decompress_stream.total_out;
34353435
34363436 if (total_in > 0) {
3437- UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO", pvar,
3438- "level %d; ratio %.1f (%ld:%ld)");
3437+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO", pvar,
3438+ "level %d; ratio %.1f (%ld:%ld)");
34393439 _snprintf_s(buf2, sizeof(buf2), _TRUNCATE, pvar->ts->UIMsg,
34403440 pvar->ssh_state.compression_level,
34413441 ((double) total_out) / total_in, total_out,
34423442 total_in);
34433443 } else {
3444- UTIL_get_lang_msg("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
3444+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_INFO2", pvar, "level %d");
34453445 _snprintf_s(buf2, sizeof(buf2), _TRUNCATE, pvar->ts->UIMsg,
34463446 pvar->ssh_state.compression_level);
34473447 }
34483448 } else {
3449- UTIL_get_lang_msg("DLG_ABOUT_COMP_NONE", pvar, "none");
3449+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_NONE", pvar, "none");
34503450 strncpy_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
34513451 }
34523452
3453- UTIL_get_lang_msg("DLG_ABOUT_COMP_UPDOWN", pvar,
3454- "Upstream %s; Downstream %s");
3453+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP_UPDOWN", pvar,
3454+ "Upstream %s; Downstream %s");
34553455 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg, buf, buf2);
34563456 }
34573457
@@ -3476,8 +3476,8 @@
34763476
34773477 void SSH_get_mac_info(PTInstVar pvar, char *dest, int len)
34783478 {
3479- UTIL_get_lang_msg("DLG_ABOUT_MAC_INFO", pvar,
3480- "%s to server, %s from server");
3479+ UTIL_get_lang_msgU8("DLG_ABOUT_MAC_INFO", pvar,
3480+ "%s to server, %s from server");
34813481 _snprintf_s(dest, len, _TRUNCATE, pvar->ts->UIMsg,
34823482 get_ssh2_mac_name(pvar->macs[MODE_OUT]),
34833483 get_ssh2_mac_name(pvar->macs[MODE_IN]));
--- trunk/ttssh2/ttxssh/ttxssh.c (revision 8546)
+++ trunk/ttssh2/ttxssh/ttxssh.c (revision 8547)
@@ -2225,7 +2225,7 @@
22252225 buf2[0] = '\0';
22262226
22272227 if (SSHv1(pvar)) {
2228- UTIL_get_lang_msg("DLG_ABOUT_SERVERID", pvar, "Server ID:");
2228+ UTIL_get_lang_msgU8("DLG_ABOUT_SERVERID", pvar, "Server ID:");
22292229 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22302230 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22312231 SSH_get_server_ID_info(pvar, buf, sizeof(buf));
@@ -2232,7 +2232,7 @@
22322232 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22332233 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22342234
2235- UTIL_get_lang_msg("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
2235+ UTIL_get_lang_msgU8("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
22362236 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22372237 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22382238 SSH_get_protocol_version_info(pvar, buf, sizeof(buf));
@@ -2239,7 +2239,7 @@
22392239 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22402240 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22412241
2242- UTIL_get_lang_msg("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
2242+ UTIL_get_lang_msgU8("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
22432243 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22442244 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22452245 CRYPT_get_cipher_info(pvar, buf, sizeof(buf));
@@ -2246,7 +2246,7 @@
22462246 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22472247 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22482248
2249- UTIL_get_lang_msg("DLG_ABOUT_SERVERKEY", pvar, "Server keys:");
2249+ UTIL_get_lang_msgU8("DLG_ABOUT_SERVERKEY", pvar, "Server keys:");
22502250 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22512251 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22522252 CRYPT_get_server_key_info(pvar, buf, sizeof(buf));
@@ -2253,7 +2253,7 @@
22532253 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22542254 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22552255
2256- UTIL_get_lang_msg("DLG_ABOUT_AUTH", pvar, "Authentication:");
2256+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH", pvar, "Authentication:");
22572257 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22582258 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22592259 AUTH_get_auth_info(pvar, buf, sizeof(buf));
@@ -2260,7 +2260,7 @@
22602260 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22612261 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22622262
2263- UTIL_get_lang_msg("DLG_ABOUT_COMP", pvar, "Compression:");
2263+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP", pvar, "Compression:");
22642264 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22652265 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22662266 SSH_get_compression_info(pvar, buf, sizeof(buf));
@@ -2268,7 +2268,7 @@
22682268 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22692269
22702270 } else { // SSH2
2271- UTIL_get_lang_msg("DLG_ABOUT_SERVERID", pvar, "Server ID:");
2271+ UTIL_get_lang_msgU8("DLG_ABOUT_SERVERID", pvar, "Server ID:");
22722272 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22732273 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22742274 SSH_get_server_ID_info(pvar, buf, sizeof(buf));
@@ -2275,13 +2275,13 @@
22752275 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22762276 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22772277
2278- UTIL_get_lang_msg("DLG_ABOUT_CLIENTID", pvar, "Client ID:");
2278+ UTIL_get_lang_msgU8("DLG_ABOUT_CLIENTID", pvar, "Client ID:");
22792279 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22802280 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22812281 strncat_s(buf2, sizeof(buf2), pvar->client_version_string, _TRUNCATE);
22822282 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22832283
2284- UTIL_get_lang_msg("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
2284+ UTIL_get_lang_msgU8("DLG_ABOUT_PROTOCOL", pvar, "Using protocol:");
22852285 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22862286 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22872287 SSH_get_protocol_version_info(pvar, buf, sizeof(buf));
@@ -2288,19 +2288,19 @@
22882288 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
22892289 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22902290
2291- UTIL_get_lang_msg("DLG_ABOUT_KEX", pvar, "Key exchange algorithm:");
2291+ UTIL_get_lang_msgU8("DLG_ABOUT_KEX", pvar, "Key exchange algorithm:");
22922292 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22932293 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
22942294 strncat_s(buf2, sizeof(buf2), get_kex_algorithm_name(pvar->kex_type), _TRUNCATE);
22952295 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
22962296
2297- UTIL_get_lang_msg("DLG_ABOUT_HOSTKEY", pvar, "Host Key:");
2297+ UTIL_get_lang_msgU8("DLG_ABOUT_HOSTKEY", pvar, "Host Key:");
22982298 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
22992299 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
23002300 strncat_s(buf2, sizeof(buf2), get_ssh_keytype_name(pvar->hostkey_type), _TRUNCATE);
23012301 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23022302
2303- UTIL_get_lang_msg("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
2303+ UTIL_get_lang_msgU8("DLG_ABOUT_ENCRYPTION", pvar, "Encryption:");
23042304 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23052305 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
23062306 CRYPT_get_cipher_info(pvar, buf, sizeof(buf));
@@ -2307,7 +2307,7 @@
23072307 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
23082308 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23092309
2310- UTIL_get_lang_msg("DLG_ABOUT_MAC", pvar, "MAC algorithm:");
2310+ UTIL_get_lang_msgU8("DLG_ABOUT_MAC", pvar, "MAC algorithm:");
23112311 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23122312 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
23132313 SSH_get_mac_info(pvar, buf, sizeof(buf));
@@ -2315,10 +2315,10 @@
23152315 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23162316
23172317 if (pvar->ctos_compression == COMP_DELAYED) { // 遅延パケット圧縮の場合 (2006.6.23 yutaka)
2318- UTIL_get_lang_msg("DLG_ABOUT_COMPDELAY", pvar, "Delayed Compression:");
2318+ UTIL_get_lang_msgU8("DLG_ABOUT_COMPDELAY", pvar, "Delayed Compression:");
23192319 }
23202320 else {
2321- UTIL_get_lang_msg("DLG_ABOUT_COMP", pvar, "Compression:");
2321+ UTIL_get_lang_msgU8("DLG_ABOUT_COMP", pvar, "Compression:");
23222322 }
23232323 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23242324 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
@@ -2326,7 +2326,7 @@
23262326 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
23272327 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23282328
2329- UTIL_get_lang_msg("DLG_ABOUT_KEXKEY", pvar, "Key exchange keys:");
2329+ UTIL_get_lang_msgU8("DLG_ABOUT_KEXKEY", pvar, "Key exchange keys:");
23302330 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23312331 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
23322332 CRYPT_get_server_key_info(pvar, buf, sizeof(buf));
@@ -2333,7 +2333,7 @@
23332333 strncat_s(buf2, sizeof(buf2), buf, _TRUNCATE);
23342334 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23352335
2336- UTIL_get_lang_msg("DLG_ABOUT_AUTH", pvar, "Authentication:");
2336+ UTIL_get_lang_msgU8("DLG_ABOUT_AUTH", pvar, "Authentication:");
23372337 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23382338 strncat_s(buf2, sizeof(buf2), " ", _TRUNCATE);
23392339 AUTH_get_auth_info(pvar, buf, sizeof(buf));
@@ -2343,7 +2343,7 @@
23432343
23442344 // ホスト公開鍵のfingerprintを表示する。
23452345 // (2014.5.1 yutaka)
2346- UTIL_get_lang_msg("DLG_ABOUT_FINGERPRINT", pvar, "Host key's fingerprint:");
2346+ UTIL_get_lang_msgU8("DLG_ABOUT_FINGERPRINT", pvar, "Host key's fingerprint:");
23472347 strncat_s(buf2, sizeof(buf2), pvar->ts->UIMsg, _TRUNCATE);
23482348 strncat_s(buf2, sizeof(buf2), "\r\n", _TRUNCATE);
23492349
@@ -2369,7 +2369,11 @@
23692369 strncat_s(buf2, sizeof(buf2), fp, _TRUNCATE);
23702370 free(fp);
23712371
2372- SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETTEXT, 0, (LPARAM)(char *)buf2);
2372+ {
2373+ wchar_t *strW = ToWcharU8(buf2);
2374+ SetDlgItemTextW(dlg, IDC_ABOUTTEXT, strW);
2375+ free(strW);
2376+ }
23732377 }
23742378 }
23752379
--- trunk/ttssh2/ttxssh/util.c (revision 8546)
+++ trunk/ttssh2/ttxssh/util.c (revision 8547)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (c) 1998-2001, Robert O'Callahan
3- * (C) 2004-2019 TeraTerm Project
3+ * (C) 2004-2020 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -320,6 +320,12 @@
320320 def, pvar->ts->UILanguageFile);
321321 }
322322
323+void UTIL_get_lang_msgU8(const char *key, PTInstVar pvar, const char *def)
324+{
325+ const char *UILanguageFile = pvar->ts->UILanguageFile;
326+ GetI18nStrU8("TTSSH", key, pvar->ts->UIMsg, MAX_UIMSG, def, UILanguageFile);
327+}
328+
323329 /*
324330 * 等幅フォントを取得
325331 * @retval フォントハンドル
--- trunk/ttssh2/ttxssh/util.h (revision 8546)
+++ trunk/ttssh2/ttxssh/util.h (revision 8547)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (c) 1998-2001, Robert O'Callahan
3- * (C) 2004-2019 TeraTerm Project
3+ * (C) 2004-2020 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,7 @@
8585 BOOL UTIL_is_sock_deeply_buffered(UTILSockWriteBuf *buf);
8686
8787 void UTIL_get_lang_msg(const char *key, PTInstVar pvar, const char *def);
88+void UTIL_get_lang_msgU8(const char *key, PTInstVar pvar, const char *def);
8889 HFONT UTIL_get_lang_fixedfont(HWND hWnd, const char *UILanguageFile);
8990
9091 #endif
Show on old repository browser