[Commits] sgpgme.c 1.1.2.72 1.1.2.73
colin at claws-mail.org
colin at claws-mail.org
Wed Aug 29 16:31:37 CEST 2012
Update of /home/claws-mail/claws/src/plugins/pgpcore
In directory srv:/tmp/cvs-serv6573/src/plugins/pgpcore
Modified Files:
Tag: gtk2
sgpgme.c
Log Message:
2012-08-29 [colin] 3.8.1cvs41
* src/plugins/pgpcore/sgpgme.c
Set gpgme's locale to UTF-8. Fixes bug #2650,
"segfault in pgp when gpgme_strerror() returns a non utf-8 string"
Index: sgpgme.c
===================================================================
RCS file: /home/claws-mail/claws/src/plugins/pgpcore/Attic/sgpgme.c,v
retrieving revision 1.1.2.72
retrieving revision 1.1.2.73
diff -u -d -r1.1.2.72 -r1.1.2.73
--- sgpgme.c 10 Jul 2012 14:10:11 -0000 1.1.2.72
+++ sgpgme.c 29 Aug 2012 14:31:35 -0000 1.1.2.73
@@ -611,13 +611,36 @@
void sgpgme_init()
{
+ gchar *ctype_locale = NULL, *messages_locale = NULL;
+ gchar *ctype_utf8_locale = NULL, *messages_utf8_locale = NULL;
+
gpgme_engine_info_t engineInfo;
if (gpgme_check_version("1.0.0")) {
#ifdef LC_CTYPE
- gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));
+ ctype_locale = g_strdup(setlocale(LC_CTYPE, NULL));
+ if (strchr(ctype_locale, '.'))
+ *(strchr(ctype_locale, '.')) = '\0';
+ else if (strchr(ctype_locale, '@'))
+ *(strchr(ctype_locale, '@')) = '\0';
+ ctype_utf8_locale = g_strconcat(ctype_locale, ".UTF-8", NULL);
+
+ gpgme_set_locale(NULL, LC_CTYPE, ctype_utf8_locale);
+
+ g_free(ctype_utf8_locale);
+ g_free(ctype_locale);
#endif
#ifdef LC_MESSAGES
- gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
+ messages_locale = g_strdup(setlocale(LC_MESSAGES, NULL));
+ if (strchr(messages_locale, '.'))
+ *(strchr(messages_locale, '.')) = '\0';
+ else if (strchr(messages_locale, '@'))
+ *(strchr(messages_locale, '@')) = '\0';
+ messages_utf8_locale = g_strconcat(messages_locale, ".UTF-8", NULL);
+
+ gpgme_set_locale(NULL, LC_MESSAGES, messages_utf8_locale);
+
+ g_free(messages_utf8_locale);
+ g_free(messages_locale);
#endif
if (!gpgme_get_engine_info(&engineInfo)) {
while (engineInfo) {
More information about the Commits
mailing list