File: japanese-patch

package info (click to toggle)
pan 0.11.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,808 kB
  • ctags: 4,297
  • sloc: ansic: 52,310; makefile: 904; sh: 840
file content (715 lines) | stat: -rw-r--r-- 19,863 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/configure.in pan-0.11.1/configure.in
--- ../pan-0.11.1/configure.in	Wed Dec  5 07:54:46 2001
+++ pan-0.11.1/configure.in	Wed Feb 13 11:14:01 2002
@@ -168,6 +168,16 @@
 AC_SUBST(GNOME_XML_CFLAGS)
 AC_SUBST(GNOME_XML_LIBS)
 
+dnl ***
+dnl *** ad-hoc Japanese
+dnl ***
+japanese=no
+AC_ARG_ENABLE(                                                                    japanese,                                                                         [  --enable-japanese           Enable Japanese code convert support\. (optional)],                                                                  
+  if test x$enableval = "xyes"; then
+        CFLAGS="$CFLAGS -DENABLE_JAPANESE"
+        japanese=yes
+  fi
+)
 
 dnl ******************************
 dnl Makefiles
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/base/Makefile.am pan-0.11.1/pan/base/Makefile.am
--- ../pan-0.11.1/pan/base/Makefile.am	Thu Nov 15 02:41:13 2001
+++ pan-0.11.1/pan/base/Makefile.am	Wed Feb 13 11:14:02 2002
@@ -12,6 +12,7 @@
 noinst_LIBRARIES = libpanbase.a
 
 libpanbase_a_SOURCES = \
+  jcode.c \
   acache.c \
   argset.c \
   article.c \
@@ -40,6 +41,7 @@
   util-wrap.c
 
 noinst_HEADERS = \
+  jcode.h \
   acache.h \
   argset.h \
   article.h \
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/base/article.c pan-0.11.1/pan/base/article.c
--- ../pan-0.11.1/pan/base/article.c	Wed Nov 28 07:40:08 2001
+++ pan-0.11.1/pan/base/article.c	Wed Feb 13 11:14:02 2002
@@ -35,6 +35,9 @@
 #include <pan/base/server.h>
 #include <pan/base/group.h>
 #include <pan/base/util-mime.h>
+#ifdef ENABLE_JAPANESE
+#include <pan/base/jcode.h>
+#endif
 
 const gchar * default_incoming_name_addr;
 const gchar * default_incoming_name_real;
@@ -888,7 +891,14 @@
 		retval = s->str;
 		g_string_free (s, FALSE);
 	}
-
+#ifdef ENABLE_JAPANESE
+    {
+        gchar * tmp;
+        tmp = kanji_conv_to_locale (retval);
+        g_free (retval);
+        retval = tmp;
+    }
+#endif
 	return retval;
 }
 
@@ -989,6 +999,14 @@
 		g_mime_message_destroy (m);
 		g_free (s);
 	}
+#ifdef ENABLE_JAPANESE
+        {
+            gchar * tmp;
+            tmp = kanji_conv_to_locale (retval);
+            g_free (retval);
+            retval = tmp;
+        }
+#endif
 
 	return retval;
 }
@@ -1013,6 +1031,14 @@
 		replace_gstr (&addr, g_mime_utils_8bit_header_decode((const guchar *)addr));
 	if (pan_header_is_8bit_encoded (real))
 		replace_gstr (&real, g_mime_utils_8bit_header_decode((const guchar *)real));
+#ifdef ENABLE_JAPANESE
+    {
+        gchar * tmp;
+        tmp = kanji_conv_to_locale (real);
+        g_free (real);
+        real = tmp;
+    }
+#endif
 
 	/* use the real mail address, or fill in a default */
 	pch = addr;
@@ -1090,6 +1116,14 @@
 
 	/* body */
 	body = g_mime_message_get_body (msg, TRUE, &foo);
+#ifdef ENABLE_JAPANESE
+	{
+		gchar * tmp;
+		tmp = kanji_conv_to_locale (body);
+		g_free (body);
+		body = tmp;
+	}
+#endif
 	article_init_header (a, PAN_BODY, body, DO_CHUNK);
 	for (lines=0, pch=body; is_nonempty_string(pch); ++pch)
 		if (*pch=='\n')
@@ -1100,12 +1134,29 @@
 	/* headers */
 	if (msg->header != NULL) {
 		a->date = msg->header->date;
-		if (msg->header->from != NULL)
+		if (msg->header->from != NULL) {
+#ifdef ENABLE_JAPANESE
+            gchar * tmp;
+            tmp = kanji_conv_to_locale (msg->header->from);
+			article_init_header (a, HEADER_FROM, tmp, DO_CHUNK_SHARE);
+            g_free (tmp);
+#else
 			article_init_header (a, HEADER_FROM, msg->header->from, DO_CHUNK_SHARE);
+#endif
+        }
 		if (msg->header->reply_to != NULL)
 			article_init_header (a, HEADER_REPLY_TO, msg->header->reply_to, DO_CHUNK_SHARE);
-		if (msg->header->subject != NULL)
+		if (msg->header->subject != NULL) {
+#ifdef ENABLE_JAPANESE
+            gchar * tmp;
+            tmp =  kanji_conv_to_locale (msg->header->subject);
+            g_print ("%s\n", tmp);
+			article_init_header (a, HEADER_SUBJECT, tmp, DO_CHUNK_SHARE);
+            g_free (tmp);
+#else
 			article_init_header (a, HEADER_SUBJECT, msg->header->subject, DO_CHUNK_SHARE);
+#endif
+        }
 		if (msg->header->message_id != NULL)
 			article_init_header (a, HEADER_MESSAGE_ID, msg->header->message_id, DO_CHUNK);
 		g_mime_header_foreach (msg->header->headers, set_from_raw_init_header_gmhfunc, a);
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/base/jcode.c pan-0.11.1/pan/base/jcode.c
--- ../pan-0.11.1/pan/base/jcode.c	Thu Jan  1 09:00:00 1970
+++ pan-0.11.1/pan/base/jcode.c	Wed Feb 13 11:14:02 2002
@@ -0,0 +1,376 @@
+ /*
+  *  jcode.c  code detect and convert with iconv(3)
+  *
+  *  Copyright (c) 2001 Takuo Kitame <kitame@debian.org>
+  *  All rights reserved.
+  *
+  *  You can use, modify and/or distribute this program under any license which
+  *  is compliant with DFSG
+  *
+  *  about DFSG <URL:http://www.debian.org/social_contract#guidelines>
+  *
+  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <errno.h>
+#include <iconv.h>
+#include "jcode.h"
+
+#define ESC          0x1b
+#define SS2          0x8e
+
+#define JCODE_LOCALE_EUC   "ja", "ja_JP", "ja_JP.ujis", "ja_JP.EUC", "ja_JP.eucJP"
+#define JCODE_LOCALE_JIS   "ja_JP.JIS", "ja_JP.jis", "ja_JP.iso-2022-jp"
+#define JCODE_LOCALE_SJIS  "ja_JP.SJIS", "ja_JP.sjis"
+
+/****************************************************************************/
+/* Japanese string code detector */
+/****************************************************************************/
+static int 
+detect_kanji(unsigned char *str)
+{
+    int expected = JCODE_ASCII;
+    register int c;
+    int c1, c2;
+    int euc_c = 0, sjis_c = 0;
+    unsigned char *ptr = str;
+    
+    while((c = (int)*ptr)!= '\0') {
+        if(c == ESC) {
+            if((c = (int)*(++ptr)) == '\0')
+                break;
+            if(c == '$') {
+                if((c = (int)*(++ptr)) == '\0')
+                    break;
+                if(c == 'B' || c == '@')
+                    return JCODE_JIS;
+            }
+            ptr++;
+            continue;
+        }
+        if((c >= 0x81 && c <= 0x8d) || (c >= 0x8f && c <= 0x9f))
+            return JCODE_SJIS;
+        
+        if(c == SS2) {
+            if((c = (int)*(++ptr)) == '\0')
+                break;
+            if((c >= 0x40 && c <= 0x7e) ||
+               (c >= 0x80 && c <= 0xa0) || 
+               (c >= 0xe0 && c <= 0xfc))
+                return JCODE_SJIS;
+            if(c >= 0xa1 && c <= 0xdf)
+                break;
+            
+            ptr++;
+            continue;
+        }        
+        if(c >= 0xa1 && c <= 0xdf) {
+            if((c = (int)*(++ptr)) == '\0')
+                break;
+            
+            if (c >= 0xe0 && c <= 0xfe)
+                return JCODE_EUC;
+            if (c >= 0xa1 && c <= 0xdf) {
+                expected = EUCORSJIS;
+                ptr++;
+                continue;
+            }
+#if 1
+            if(c == 0xa0 || (0xe0 <= c && c <= 0xfe))
+                return JCODE_EUC;
+            else {
+                expected = EUCORSJIS;
+                ptr++;
+                continue;
+            }
+#else
+            if(c <= 0x9f)
+                return JCODE_SJIS;
+            if(c >= 0xf0 && c <= 0xfe)
+                return JCODE_EUC;
+#endif
+            
+            if(c >= 0xe0 && c <= 0xef) {
+                expected = EUCORSJIS;
+                while(c >= 0x40) {
+                    if(c >= 0x81) {
+                        if(c <= 0x8d || (c >= 0x8f && c <= 0x9f))
+                            return JCODE_SJIS;
+                        else if(c >= 0xfd && c <= 0xfe) {
+                            return JCODE_EUC;
+                        }
+                    }
+                    if((c = (int)*(++ptr)) == '\0')
+                        break;
+                }
+                ptr++;
+                continue;
+            }
+            
+            if(c >= 0xe0 && c <= 0xef) {
+                if((c = (int)*(++ptr)) == '\0')
+                    break;
+                if((c >= 0x40 && c <= 0x7e) || (c >= 0x80 && c <= 0xa0))
+                    return JCODE_SJIS;
+                if(c >= 0xfd && c <= 0xfe)
+                    return JCODE_EUC;
+                if(c >= 0xa1 && c <= 0xfc)
+                    expected = EUCORSJIS;
+            }
+        }
+#if 1
+        if (0xf0 <= c && c <= 0xfe)
+            return JCODE_EUC;
+#endif
+        ptr++;
+    }
+
+   ptr = str;
+   c2 = 0;
+   while((c1 = (int)*ptr++) != '\0') {
+       if(((c2 >  0x80 && c2 < 0xa0) || (c2 >= 0xe0 && c2 < 0xfd)) &&
+          ((c1 >= 0x40 && c1 < 0x7f) || (c1 >= 0x80 && c1 < 0xfd)))
+           sjis_c++, c1 = *ptr++;
+       c2 = c1;
+   }
+
+/*
+   if(sjis_c == 0)
+       expected = JCODE_EUC;
+   else {
+*/
+   {
+       ptr = str, c2 = 0;
+       while((c1 = (int)*ptr++) != '\0') {
+	     if((c2 > 0xa0  && c2 < 0xff) &&
+            (c1 > 0xa0  && c1 < 0xff))
+             euc_c++, c1 = *ptr++;
+	     c2 = c1;
+       }
+       if(sjis_c > euc_c)
+           expected = JCODE_SJIS;
+       else if (euc_c > 0)
+           expected = JCODE_EUC;
+       else 
+           expected = JCODE_ASCII;
+   }
+   return expected;
+}
+
+static int
+int_detect_JCode(char *str)
+{
+    int detected;
+
+    if(!str)
+        return 0;
+
+    detected = detect_kanji((unsigned char *)str);
+    
+    if(detected == JCODE_ASCII)
+        return JCODE_ASCII;
+    
+    switch(detected) {
+    case JCODE_EUC:
+        return JCODE_EUC;
+        break;
+    case JCODE_JIS:
+        return JCODE_JIS;
+        break;
+    case JCODE_SJIS:  
+        return JCODE_SJIS;
+        break;
+    default:
+        return JCODE_ASCII;
+        break;
+    }
+    
+    /* not reached */
+    return 0;
+}
+
+#if 0
+static const char *
+detect_JCode(char *str)
+{
+    int detected;
+
+    if(!str)
+        return NULL;
+
+    detected = detect_kanji((unsigned char *)str);
+    
+    if(detected == JCODE_ASCII)
+        return "ASCII";
+
+    switch(detected) {
+    case JCODE_EUC:
+        return "EUC-JP";
+        break;
+    case JCODE_JIS:
+        return "ISO-2022-JP";
+        break;
+    case JCODE_SJIS:  
+        return "SJIS";
+        break;
+    default:
+        return "ASCII";
+        break;
+    }
+    
+    /* not reached */
+    return 0;
+}
+#endif
+
+char *
+kanji_conv_auto(char *str, const char *dstset)
+{
+    unsigned char *buf, *ret;
+    iconv_t cd;
+    size_t insize = 0;
+    size_t outsize = 0;
+    size_t nconv = 0;
+    char *inptr;
+    char *outptr;
+    char srcset[16];
+
+    if(!str)
+        return NULL;
+    
+    switch (int_detect_JCode(str)) {
+    case JCODE_EUC:
+        strcpy(srcset, "EUC-JP");
+        break;
+    case JCODE_JIS:
+        strcpy(srcset, "ISO-2022-JP");
+        break;
+    case JCODE_SJIS:
+        strcpy(srcset, "SJIS");
+        break;
+    default:
+        /* printf("failed!! \n"); */
+        return strdup(str);
+        break;
+    }
+#ifdef DEBUG
+    printf("to %s from %s (%s)\n", dstset, srcset, str);
+#endif
+    buf = (unsigned char *)malloc(strlen(str)* 4 + 1);
+    if(!buf)
+        return NULL;
+    
+    insize = strlen(str);
+    inptr = str;
+    outsize = strlen(str) * 4 ;
+    outptr = buf;
+    
+    cd = iconv_open(dstset, srcset);
+    if(cd == (iconv_t) -1) {
+        if(errno == EINVAL)
+            return strdup(str);
+    }
+    
+    nconv = iconv(cd, (const char **)&inptr, &insize, &outptr, &outsize);
+    if(nconv == (size_t) -1) {
+        if (errno == EINVAL)
+            memmove (buf, inptr, insize);
+    } else
+        iconv(cd, NULL, NULL, &outptr, &outsize);
+    
+    *outptr = '\0';
+    iconv_close(cd);
+    
+    ret = strdup(buf);
+    free(buf);
+
+    return ret;
+}
+
+/* convert to system locale code */
+char *
+kanji_conv_to_locale(char *str)
+{
+   static char *jpcode = NULL;
+   static char *locale_euc[]  = { JCODE_LOCALE_EUC, NULL };
+   static char *locale_jis[]  = { JCODE_LOCALE_JIS, NULL };
+   static char *locale_sjis[] = { JCODE_LOCALE_SJIS, NULL };
+
+   static struct LOCALE_TABLE {
+       char *code;
+       char **name_list;
+   } locale_table[] = { 
+       {"EUC-JP", locale_euc},
+       {"ISO-2022-JP", locale_sjis},
+       {"SJIS", locale_sjis}
+   };
+
+   if(!str)
+       return NULL;
+
+   if(jpcode == NULL) {
+       char *ctype = setlocale(LC_CTYPE, "");
+       int i, j;
+       for( j=0; jpcode == NULL && 
+                j < sizeof(locale_table)/sizeof(struct LOCALE_TABLE); j++ ) {
+           char **name = locale_table[j].name_list;
+           for( i=0; name[i]; i++ )
+               if (strcasecmp(ctype, name[i]) == 0) {
+                   jpcode = locale_table[j].code;
+                   break;
+               }
+       }
+       if(jpcode == NULL)
+           jpcode = locale_table[1].code;
+   }
+   
+   return kanji_conv_auto(str, jpcode);
+}
+
+char *
+kanji_conv(char *str, const char *dstset, const char *srcset)
+{
+    unsigned char *buf, *ret;
+    iconv_t cd;
+    size_t insize = 0;
+    size_t outsize = 0;
+    size_t nconv = 0;
+    char *inptr;
+    char *outptr;
+    
+    if(!str)
+        return NULL;
+    
+    buf = (unsigned char *)malloc(strlen(str) * 4 + 1);
+    if(!buf)
+        return NULL;
+    
+    insize = strlen(str);
+    inptr = str;
+    outsize = strlen(str) * 4 ;
+    outptr = buf;
+    
+    cd = iconv_open (dstset, srcset);
+    if(cd == (iconv_t) -1) {
+        if(errno == EINVAL)
+            return strdup(str);
+    }
+    
+    nconv = iconv (cd, (const char **)&inptr, &insize, &outptr, &outsize);
+    if (nconv == (size_t) -1) {
+        if(errno == EINVAL)
+            memmove (buf, inptr, insize);
+    } else
+       iconv (cd, NULL, NULL, &outptr, &outsize);
+    
+    *outptr = '\0';
+    iconv_close(cd);
+    
+    ret = strdup(buf);
+    free(buf);
+    
+    return ret;
+}
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/base/jcode.h pan-0.11.1/pan/base/jcode.h
--- ../pan-0.11.1/pan/base/jcode.h	Thu Jan  1 09:00:00 1970
+++ pan-0.11.1/pan/base/jcode.h	Wed Feb 13 11:14:02 2002
@@ -0,0 +1,28 @@
+ /*
+  *  jcode.c  code detect and convert with iconv(3)
+  *
+  *  Copyright (c) 2001 Takuo Kitame <kitame@debian.org>
+  *  All rights reserved.
+  *
+  *  You can use, modify and/or distribute this program under any license which
+  *  is compliant with DFSG
+  *
+  *  about DFSG <URL:http://www.debian.org/social_contract#guidelines>
+  *
+  */
+
+#ifndef __JCODE_H__
+#define __JCODE_H__
+
+enum {
+    JCODE_ASCII,
+    JCODE_EUC,
+    JCODE_JIS,
+    JCODE_SJIS,
+    EUCORSJIS };
+
+char *kanji_conv(char *str, const char *dstset, const char *srcset);
+char *kanji_conv_auto(char *str, const char *dstset);
+char *kanji_conv_to_locale(char *str);
+
+#endif
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/message-send.c pan-0.11.1/pan/message-send.c
--- ../pan-0.11.1/pan/message-send.c	Sun Nov 25 10:49:50 2001
+++ pan-0.11.1/pan/message-send.c	Wed Feb 13 11:14:01 2002
@@ -45,6 +45,9 @@
 #include <pan/queue.h>
 #include <pan/task-func-ptr.h>
 #include <pan/smtp.h>
+#ifdef ENABLE_JAPANESE
+#include <pan/base/jcode.h>
+#endif
 
 enum MessageSendResult
 {
@@ -134,7 +137,16 @@
 
 	/* Organization: */
 	pch = article_get_header (article, HEADER_ORGANIZATION);
+#ifdef ENABLE_JAPANESE
+    {
+        gchar * tmp1;
+        tmp1 = kanji_conv_auto ((gchar *)pch, "ISO-2022-JP");
+        tmp = g_mime_utils_8bit_header_encode (tmp1);
+        g_free (tmp1);
+    }
+#else
 	tmp = g_mime_utils_8bit_header_encode (pch);
+#endif
 	if (is_nonempty_string (tmp))
 		g_string_sprintfa (postme, "Organization: %s\r\n", tmp);
 	g_free (tmp);
@@ -291,6 +303,13 @@
 
 		/* body */
 		tmp = article_get_body (article);
+#ifdef ENABLE_JAPANESE
+        {
+            gchar *tmp1;
+            tmp1 = kanji_conv_auto (tmp, "ISO-2022-JP");
+            g_free (tmp); tmp = tmp1;
+        }
+#endif
 		g_string_assign (body, tmp);
 		g_free (tmp);
 		pan_g_string_replace (body, "\n.", "\n.."); /* RFC977 3.10.1 ... */
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/message-window.c pan-0.11.1/pan/message-window.c
--- ../pan-0.11.1/pan/message-window.c	Wed Oct 31 03:50:24 2001
+++ pan-0.11.1/pan/message-window.c	Wed Feb 13 11:14:01 2002
@@ -56,6 +56,9 @@
 #include <pan/task-body.h>
 #include <pan/text.h> /* for colors of fg, bg, and quoted text */
 #include <pan/util.h>
+#ifdef ENABLE_JAPANESE
+#include <pan/base/jcode.h>
+#endif
 
 typedef struct
 {
@@ -153,7 +156,6 @@
 	experimental_toggle_active = gtk_toggle_button_get_active (togglebutton);
 }
 
-
 static void
 text_inserted_cb (GtkEditable * editable,
                   gchar * new_text,
@@ -1382,7 +1384,6 @@
 	/**
 	***  Subject
 	**/
-
 	cp = a != NULL ? a->subject : NULL;
 	p = NULL;
 	if (cp != NULL) {
@@ -1709,6 +1710,14 @@
 
 	/* open up a populated reply window. */
 	body = text_get_message_to_reply_to ();
+#ifdef ENABLE_JAPANESE
+    {
+        gchar *tmp;
+        tmp = kanji_conv_to_locale (body);
+        g_free (body);
+        body = tmp;
+    }
+#endif    
 	article_set_header (article, PAN_REPLY_PORTION, body, DO_CHUNK);
 	message_window_new (article, type);
 	g_free (body);
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/nntp.c pan-0.11.1/pan/nntp.c
--- ../pan-0.11.1/pan/nntp.c	Tue Dec  4 05:42:12 2001
+++ pan-0.11.1/pan/nntp.c	Wed Feb 13 11:14:01 2002
@@ -40,6 +40,10 @@
 #include <pan/prefs.h>
 #include <pan/task.h>
 
+#ifdef ENABLE_JAPANESE
+#include <pan/base/jcode.h>
+#endif
+
 gboolean online_prompt = TRUE;
 
 /** deprecated, use nntp_command */
@@ -736,12 +740,26 @@
 		/* get subject */
 		if (get_next_token_run (march, '\t', &march, &tok, &tok_len)) {
 			((gchar*)tok)[tok_len] = '\0';
-			if (!pan_header_is_8bit_encoded (tok))
+			if (!pan_header_is_8bit_encoded (tok)) {
+#ifdef ENABLE_JAPANESE
+				gchar * tmp;
+				tmp = kanji_conv_to_locale (tok);
+				article_init_header (a, HEADER_SUBJECT, tmp, DO_CHUNK_SHARE);
+				g_free (tmp);
+#else
 				article_init_header (a, HEADER_SUBJECT, tok, DO_CHUNK_SHARE);
-			else {
+#endif
+			} else {
 				gchar * dec = g_mime_utils_8bit_header_decode ((const guchar*)tok);
+#ifdef ENABLE_JAPANESE
+				gchar * tmp;
+				tmp = kanji_conv_to_locale (dec);
+				article_init_header (a, HEADER_SUBJECT, tmp, DO_CHUNK_SHARE);
+				g_free (dec); g_free (tmp);
+#else
 				article_init_header (a, HEADER_SUBJECT, dec, DO_CHUNK_SHARE);
 				g_free (dec);
+#endif
 			}
 		}
 
diff -Nur --exclude Makefile.in --exclude debian ../pan-0.11.1/pan/prefs.c pan-0.11.1/pan/prefs.c
--- ../pan-0.11.1/pan/prefs.c	Wed Feb 13 11:11:17 2002
+++ pan-0.11.1/pan/prefs.c	Wed Feb 13 11:14:01 2002
@@ -57,11 +57,11 @@
  
 #define DISPLAY_PREFS_PREVIEW_FONT_SIZE 14
 
-#define NORMAL_FONT     "-adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*"
+#define NORMAL_FONT     "-adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*,*"
 
-#define BOLD_FONT         "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
+#define BOLD_FONT         "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*,*"
 
-#define FIXED_FONT        "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-*"
+#define FIXED_FONT        "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-*,*"
 
 
 /* server profile */
@@ -244,7 +244,7 @@
 gboolean pan_mute                             = FALSE;
 gboolean auto_part_selection                  = TRUE;
 gboolean wrap_body_on_reply                   = TRUE;
-gboolean use_gdk_fontset_load                 = FALSE;
+gboolean use_gdk_fontset_load                 = TRUE;
 gboolean fetch_new_on_group_load              = TRUE;
 gboolean navigate_cached_only                 = FALSE;
 gboolean navigate_read_on_select              = TRUE;