quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] Fix encoding problems


From: Thomas Petazzoni
Subject: [Quilt-dev] [PATCH] Fix encoding problems
Date: Mon, 8 May 2006 12:35:24 +0200

Hi,

Yesterday, I used Quilt to handle a couple of patches for a
French-speaking project. And I discovered that in the editor launched
by "quilt edit", "quilt header -e" or "quilt mail", I could not enter
"special" characters: I was limited to the ASCII 7-bit characters. They
might be sufficient for english-speaking people but certainly not for
other languages ;-)

In fact, the problem comes from quilt/scripts/patchfns.in which starts
by setting LANG to POSIX, unconditionally. So, later, editors (in quilt
edit, quilt header -e or quilt mail) are launched with LANG=POSIX, and
then don't allow to enter non-ASCII characters.

This problem is fixed by using LANG=$ORIGINAL_LANG before launching the
editors in quilt edit, quilt header -e and quilt mail. ORIGINAL_LANG is
already set by quilt/scripts/patchfns.in, just before it modifies LANG.

In quilt mail, I also fixed the charset detection: it was based on
$LANG if $LC_ALL was empty. But $LANG is always POSIX, so it is not
really helpful. So, we use $ORIGINAL_LANG here too.

However, there are still some problems left with mail sending. The
subject field is not correctly encoded, the Content-Type is not
specified. I have not yet looked enough into quilt/mail.in and in the
edmail helper script to fix these issues.

Patch applies to current CVS.

Sincerly,

Thomas

Index: quilt/edit.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/edit.in,v
retrieving revision 1.13
diff -u -r1.13 edit.in
--- quilt/edit.in       21 Mar 2006 15:57:13 -0000      1.13
+++ quilt/edit.in       8 May 2006 10:26:41 -0000
@@ -65,7 +65,7 @@
 then
        exit $status
 fi
-$EDITOR "${@/#/$SUBDIR}"
+LANG=$ORIGINAL_LANG $EDITOR "${@/#/$SUBDIR}"
 status=$?
 for file in "$@"
 do
Index: quilt/header.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/header.in,v
retrieving revision 1.8
diff -u -r1.8 header.in
--- quilt/header.in     27 Jan 2006 04:38:14 -0000      1.8
+++ quilt/header.in     8 May 2006 10:26:41 -0000
@@ -149,7 +149,7 @@
 
        if [ -n "$opt_edit" ]
        then
-               $EDITOR "$tmp" || exit 1
+               LANG=$ORIGINAL_LANG $EDITOR "$tmp" || exit 1
        fi
 
        maybe_strip_diffstat < $tmp \
Index: quilt/mail.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/mail.in,v
retrieving revision 1.24
diff -u -r1.24 mail.in
--- quilt/mail.in       25 Mar 2006 20:08:05 -0000      1.24
+++ quilt/mail.in       8 May 2006 10:26:41 -0000
@@ -171,7 +171,7 @@
 fi
 
 if [ -z "$opt_charset" ]; then
-       case "${LC_ALL:-$LANG}" in
+       case "${LC_ALL:-$ORIGINAL_LANG}" in
        *.UTF-8)
                opt_charset=UTF-8
                ;;
@@ -354,7 +354,7 @@
 
 if [ -z "$opt_message" ]
 then
-       if ! $EDITOR $introduction; then
+       if ! LANG=$ORIGINAL_LANG $EDITOR $introduction; then
                rm -f $introduction
                exit 1
        fi


-- 
PETAZZONI Thomas - address@hidden 
http://{thomas,sos,kos}.enix.org - Jabber: address@hidden
http://{agenda,livret}dulibre.org - http://www.toulibre.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

Attachment: signature.asc
Description: PGP signature


reply via email to

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