nmh-workers
[Top] [All Lists]

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

2005-02-15 03:45:25
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?

Oliver

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 @@
                                sp++;\
                        }\
                        while ((c = (unsigned char) *sp++) && --i >= 0 && cp < 
ep)\
-                               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) || 
isspace(c)))\
                        sp++;\
                    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) || 
isspace(c)))\


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>