]> git.neil.brown.name Git - edlib.git/commitdiff
doc-email: clear charset when not used.
authorNeilBrown <neil@brown.name>
Mon, 30 Jan 2023 04:30:11 +0000 (15:30 +1100)
committerNeilBrown <neil@brown.name>
Mon, 30 Jan 2023 04:30:11 +0000 (15:30 +1100)
If the charset variable is not being used, its value becomes stale, and
copying it to a pane attr causes corruption.  This results in non-utf8
being passed to pango_layout_set_text()

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
doc-email.c

index 9a977d96dade22d37c141f8392974fbe84199683..bf7d4fb5b85d9a92f6c7739c505cb16707823071 100644 (file)
@@ -35,7 +35,7 @@ Bugs to be fixed
 - [ ] auto-sign emails..
 - [ ] message must be tagged "replied" when a reply is sent.
 - [ ] if a shell command produces no output, message should be shown
-- [ ] pango_layout_set_text() is sometimes given invalid UTF-8
+- [X] pango_layout_set_text() is sometimes given invalid UTF-8
 - [ ] be sure to wait for xdg-open etc.
 - [ ] things slow down after lots of edits.  Maybe track
       number of chunk, marks, undos etc and display them somewhere
index c86a06f4844c1c7d899a7d76bd834f5e1de7de4d..c2bbc39fd261d50b95f84edea5f63195a02a3d74 100644 (file)
@@ -453,7 +453,7 @@ static bool handle_text(struct pane *p safe, char *type, char *xfer, char *disp,
                }
                if (xfer && xlen == 4 &&
                    strncasecmp(xfer, "8bit", 6) == 0)
-                       need_charset = 2; // ony if not utf-8
+                       need_charset = 2; // only if not utf-8
        }
        if (type && need_charset &&
            (charset = get_822_attr(type, "charset")) != NULL &&
@@ -476,7 +476,8 @@ static bool handle_text(struct pane *p safe, char *type, char *xfer, char *disp,
                        hx = call_ret(pane, "attach-charset-windows-1251", h);
                if (hx)
                        h = hx;
-       }
+       } else
+               charset = NULL;
        if (type && (fname = get_822_attr(type, "name")))
                fname = strsave(h, fname);
        if (disp && !fname &&