Subject: missing charset for non-ASCII text/x-patch MIME parts in Thunderbird

From: Ivan Shmakov <[email-masked]>
Date: Thu, 14 May 2015 07:10:50 +0000

>>>>> Dmitry Gutov <[email-masked]> writes:

	[Moving to emacs-devel@ as the issue at hand is not exactly
	related to #20385.]

[…]

 > For some reason still unclear to me (I have English locale and
 > language set everywhere I can see), it displays a group of cyrillic
 > characters (тАШ) instead of the fancy quotes.  Which will complicate
 > reading small patches somewhat (ones I wouldn't open in an external
 > program otherwise).

	As I’ve pointed earlier [1], Thunderbird (on the /sending/ side)
	for some reason chooses /not/ to file the ‘charset’
	Content-Type: field for text/x-patch MIME parts.  In the absence
	of the explicitly-stated encoding, the receiving side may resort
	to guessing, or (if the buffer model so allows, and Emacs’
	/does/) may simply leave the content undecoded (as in:
	raw-text.)

	I presume this issue (the one of /not/ including the ‘charset’)
	is specific to Thunderbird.  As an example, please look at a
	fragment of the original patch thus MIMEd from Gnus.

[1] news:[email-masked]
    http://debbugs.gnu.org/20499#108

-- 
FSF associate member #7257  http://am-1.org/~ivan/      … 3013 B6A0 230E 334A
>From eb392195ffdb108228c981f92ca8b5766afdcff9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Wed, 13 May 2015 00:10:00 -0700
Subject: [PATCH] Support curved quotes in doc strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Emacs's traditional doc string style has been to quote symbols
`like this'.  This worked well on now-obsolete terminals where
` and ' were symmetric quotes, but nowadays curved quotes
‘like this’ look better.  Support quoting the new way too.
(Bug#20385)
* doc/lispref/tips.texi (Documentation Tips): Symbols can be quoted
‘like-this’ as well as `like-this'.
* etc/NEWS: Mention this.
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2):
* lisp/finder.el (finder-font-lock-keywords):
* lisp/gnus/gnus-art.el (gnus-button-alist):
* lisp/help-mode.el (help-xref-symbol-regexp)
(help-xref-info-regexp, help-xref-url-regexp):
* lisp/international/mule-cmds.el (help-xref-mule-regexp-template):
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode):
Add "‘" and "’" to electric-pair-text-pairs.
(elisp--form-quoted-p): Also allow "‘" as a quoting char.
(elisp-completion-at-point, elisp--preceding-sexp):
Also treat "‘" and "’" as quoting chars.
* lisp/wid-edit.el (widget-documentation-link-regexp):
Parse symbols quoted ‘like-this’ as well as `like-this'.
---
 doc/lispref/tips.texi           | 33 ++++++++++++++++++---------------
 etc/NEWS                        |  4 ++++
 lisp/cedet/srecode/texi.el      |  2 +-
 lisp/emacs-lisp/checkdoc.el     |  5 +++--
 lisp/emacs-lisp/lisp-mode.el    |  8 ++++----
 lisp/finder.el                  |  2 +-
 lisp/gnus/gnus-art.el           |  8 ++++----
 lisp/help-mode.el               |  7 ++++---
 lisp/international/mule-cmds.el |  2 +-
 lisp/progmodes/elisp-mode.el    | 24 +++++++++++++-----------
 lisp/wid-edit.el                |  2 +-
 11 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index cc1f0e4..912d746 100644
…
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 0a95783..dac3b1e 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2863,7 +2863,7 @@ The following properties have special meanings for this widget:
   :type 'boolean
   :group 'widget-documentation)
 
-(defcustom widget-documentation-link-regexp "`\\([^\n`' ]+\\)'"
+(defcustom widget-documentation-link-regexp "[`‘]\\([^\n `'‘’]+\\)['’]"
   "Regexp for matching potential links in documentation strings.
 The first group should be the link itself."
   :type 'regexp
-- 
2.1.0