summaryrefslogtreecommitdiffstats
path: root/rfc2047.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-09-12 19:51:47 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-09-12 19:51:47 +0000
commit43c36fea59cd40d1f7393b921acf477590429fef (patch)
treec649bf4b9c808786047702e222a472af0c60c167 /rfc2047.c
parent3d99b5254b7a81d4ce32663c53291ab66e406212 (diff)
[patch-0.93.2i.ru.mmultiple_charsets.gz] This patch adds
support for international character sets. Currently, mutt knows about the following character sets and is able to convert between them: iso-8859-1, ..., iso-8859-9, koi8-r, windows-1251, x-cp866. (From: Ruslan Ermilov <ru@ucb.crimea.ua>)
Diffstat (limited to 'rfc2047.c')
-rw-r--r--rfc2047.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/rfc2047.c b/rfc2047.c
index 25ba7914..a302afb2 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -18,6 +18,7 @@
#include "mutt.h"
#include "mime.h"
+#include "charset.h"
#include "rfc2047.h"
#include <ctype.h>
@@ -244,6 +245,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len)
char *pp = p;
char *pd = d;
int enc = 0, filter = 0, count = 0, c1, c2, c3, c4;
+ char *charset;
while ((pp = strtok (pp, "?")) != NULL)
{
@@ -252,7 +254,10 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len)
{
case 2:
if (strcasecmp (pp, NONULL(Charset)) != 0)
+ {
filter = 1;
+ charset = pp;
+ }
break;
case 3:
if (toupper (*pp) == 'Q')
@@ -319,17 +324,20 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len)
}
pp = 0;
}
- safe_free ((void **) &p);
if (filter)
{
- pd = d;
- while (*pd)
+ if (mutt_display_string(d, mutt_get_charset(charset), mutt_get_charset(Charset)) == -1)
{
- if (!IsPrint (*pd))
- *pd = '?';
- pd++;
+ pd = d;
+ while (*pd)
+ {
+ if (!IsPrint (*pd))
+ *pd = '?';
+ pd++;
+ }
}
}
+ safe_free ((void **) &p);
return (0);
}