[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] scan or show of UTF-encoded headers?

From: Oliver Kiddle
Subject: Re: [Nmh-workers] scan or show of UTF-encoded headers?
Date: Tue, 15 Feb 2005 10:50:24 +0100

Paul Fox wrote:
> it seems that this patch relies on other local changes you've
> made to your tree -- i went searching for "get_charset" with google,
> and came up with a message you sent to this list on january 24
> which contained such a routine, in different mime-related patch.  :-)

The patch is against what is currently in the CVS repository which
includes my patch from last month. If you can check the code out of CVS,
it should apply against that. Otherwise, let me know and I'll put a
tarball somewhere you can download it from.

Having experimented with the patch a little myself, I've found that in a
UTF-8 locale it has problems with the PUTS macro in fmt_scan.c. The
macro strips out control characters but isgraph() doesn't work with
multibyte characters. The following patch is a hack to make it basically
work for UTF-8. For a proper fix, we will need to adjust the formatting
code to handle multibyte characters properly. The width
padding/truncating also breaks with multibyte characters. Does anyone
know if the mh interfaces (mh-e etc) rely on the width truncating to
avoid overflowing fixed width buffers?


Index: sbr/fmt_scan.c
RCS file: /cvsroot/nmh/nmh/sbr/fmt_scan.c,v
retrieving revision 1.13
diff -u -r1.13 fmt_scan.c
--- sbr/fmt_scan.c      30 Sep 2003 19:55:12 -0000      1.13
+++ sbr/fmt_scan.c      15 Feb 2005 09:01:35 -0000
@@ -130,7 +130,7 @@
                        while ((c = (unsigned char) *sp++) && --i >= 0 && cp < 
-                               if (isgraph(c)) \
+                               if (!iscntrl(c) && !isspace(c)) \
                                    *cp++ = c;\
                                else {\
                                        while ((c = (unsigned char) *sp) && 
(iscntrl(c) || isspace(c)))\
@@ -148,7 +148,7 @@
                    while ((c = (unsigned char) *sp) && (iscntrl(c) || 
                    while((c = (unsigned char) *sp++) && cp < ep)\
-                       if (isgraph(c)) \
+                       if (!iscntrl(c) && !isspace(c)) \
                            *cp++ = c;\
                        else {\
                            while ((c = (unsigned char) *sp) && (iscntrl(c) || 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]