emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 a377c65: Fix Dired display and operations on file


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 a377c65: Fix Dired display and operations on file names with raw bytes
Date: Sat, 6 Jan 2018 03:57:11 -0500 (EST)

branch: emacs-26
commit a377c652b55db4f118076fec2cdbd65e0d61e31a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix Dired display and operations on file names with raw bytes
    
    * src/coding.c (decode_coding): When flushing remaining raw bytes
    from multibyte text, copy 2-byte forms of eight-bit-*
    characters as single characters, not as 2 raw bytes.  (Bug#29189)
---
 src/coding.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/coding.c b/src/coding.c
index 35f8505..a7b040e 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7423,10 +7423,23 @@ decode_coding (struct coding_system *coding)
 
          while (nbytes-- > 0)
            {
-             int c = *src++;
+             int c;
 
-             if (c & 0x80)
-               c = BYTE8_TO_CHAR (c);
+             /* Copy raw bytes in their 2-byte forms from multibyte
+                text as single characters.  */
+             if (coding->src_multibyte
+                 && CHAR_BYTE8_HEAD_P (*src) && nbytes > 0)
+               {
+                 c = STRING_CHAR_ADVANCE (src);
+                 nbytes--;
+               }
+             else
+               {
+                 c = *src++;
+
+                 if (c & 0x80)
+                   c = BYTE8_TO_CHAR (c);
+               }
              coding->charbuf[coding->charbuf_used++] = c;
            }
          produce_chars (coding, Qnil, 1);



reply via email to

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