Add support for the iso-8859-8-i encoding
authorAndrej Kacian <ticho@claws-mail.org>
Wed, 14 Feb 2018 22:03:17 +0000 (23:03 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Wed, 14 Feb 2018 22:03:17 +0000 (23:03 +0100)
Support this encoding by aliasing it to iso-8859-8.

src/codeconv.c
src/codeconv.h

index 0d2438b..4fb3f69 100644 (file)
@@ -706,12 +706,24 @@ static gint conv_noconv(gchar *outbuf, gint outlen, const gchar *inbuf)
 static const gchar *
 conv_get_fallback_for_private_encoding(const gchar *encoding)
 {
-       if (encoding && (encoding[0] == 'X' || encoding[0] == 'x') &&
-           encoding[1] == '-') {
-               if (!g_ascii_strcasecmp(encoding, CS_X_MACCYR))
-                       return CS_MACCYR;
-               if (!g_ascii_strcasecmp(encoding, CS_X_GBK))
-                       return CS_GBK;
+       if (encoding) {
+               if ((encoding[0] == 'X' || encoding[0] == 'x') &&
+                   encoding[1] == '-') {
+                       if (!g_ascii_strcasecmp(encoding, CS_X_MACCYR))
+                               return CS_MACCYR;
+                       if (!g_ascii_strcasecmp(encoding, CS_X_GBK))
+                               return CS_GBK;
+               }
+               else if(!g_ascii_strcasecmp(encoding, CS_ISO_8859_8_I)) {
+                       /*
+                        * ISO-8859-8-I is a variant which fully
+                        * agrees with ISO-8859-8 on character
+                        * codings, and differs only in directionality
+                        * implications, which are ignored here
+                        * anyway; and is not recognized by iconv
+                        */
+                       return CS_ISO_8859_8;
+               }
        }
 
        return encoding;
index f025864..9cf2596 100644 (file)
@@ -116,6 +116,7 @@ struct _CodeConverter
 #define CS_ISO_8859_6          "ISO-8859-6"
 #define CS_ISO_8859_7          "ISO-8859-7"
 #define CS_ISO_8859_8          "ISO-8859-8"
+#define CS_ISO_8859_8_I        "ISO-8859-8-I"
 #define CS_ISO_8859_9          "ISO-8859-9"
 #define CS_ISO_8859_10         "ISO-8859-10"
 #define CS_ISO_8859_11         "ISO-8859-11"