From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#39506: patch Date: Sat, 08 Feb 2020 14:51:02 -0500 Message-ID: References: <87tv419ail.fsf@dick> <877e0xf72p.fsf@dick> <87v9ohdr21.fsf@dick> <87o8u8ewdj.fsf@dick> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="67225"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39506@debbugs.gnu.org To: dick.r.chiang@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 08 20:52:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j0W9E-000HMu-82 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Feb 2020 20:52:12 +0100 Original-Received: from localhost ([::1]:44862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0W9C-0005M6-To for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Feb 2020 14:52:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56219) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0W95-0005Lw-J5 for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 14:52:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0W94-0007h2-JZ for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 14:52:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0W94-0007g4-EH for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 14:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j0W94-0005KZ-AA; Sat, 08 Feb 2020 14:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Sat, 08 Feb 2020 19:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39506 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 39506-submit@debbugs.gnu.org id=B39506.158119147520436 (code B ref 39506); Sat, 08 Feb 2020 19:52:02 +0000 Original-Received: (at 39506) by debbugs.gnu.org; 8 Feb 2020 19:51:15 +0000 Original-Received: from localhost ([127.0.0.1]:51855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0W8I-0005JX-UF for submit@debbugs.gnu.org; Sat, 08 Feb 2020 14:51:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0W8F-0005JG-6L for 39506@debbugs.gnu.org; Sat, 08 Feb 2020 14:51:13 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7FAF5100EC5; Sat, 8 Feb 2020 14:51:05 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D3AB5100E92; Sat, 8 Feb 2020 14:51:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1581191463; bh=sEF6FrfmBoCFHXVWZGCoPZsLxPO0mu1ph/uXNbMmFGo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=as1rnEJ5glqKpU/xLNZsmEKe2q4yNaus10ME9Eo4dfznl48WcuwvJfOyYxHijklec dtEEeyXz3ajNVvucavxYWrtfuJOxHHPjwTu9ZgarpK/na+twEhh6OEMDFc3uLFZLfD szOa8a2HW1gXWohRG7Jn7kR83Buz7UEGHDPUccCUdMDwo/ebTSgGTZwWawtYTbz0Kk rJ7qqXMC+ZiNYqfzUyUCALyIE1UQ9GAwHoUAS79Pa1wfatA0iyQG1psXB7NkR1e2x/ DSzWexkrXW0HtW0CEy+gYldjmkmQTxUMJe0/EjPFwfzI6JK/SagWTE15Pwp7N5RNEU vsXNiVKEn5f4Q== Original-Received: from pastel (unknown [157.52.14.222]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6831D120422; Sat, 8 Feb 2020 14:51:03 -0500 (EST) In-Reply-To: <87o8u8ewdj.fsf@dick> (dick r. chiang's message of "Sat, 08 Feb 2020 14:01:44 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175808 Archived-At: >> - Before deciding whether unibyte or multibyte is the right choice, the >> main question is whether the buffer contains bytes or chars. > My buffer contained some Chinese multibytes. That suggests it contains characters rather than bytes. How did that happen? Where does this buffer ('s contents) come from? > You can see my unit test in the patch. In your unit test, you artificially create a multibyte buffer with chinese chars, so that doesn't answer my question ;-) AFAIK `mm-with-part` is designed for MIME parts and MIME parts can only contain bytes at that point. Only after we extract them as bytes and apply `mm-decode-content-transfer-encoding` to it can we consider decoding those bytes into chars. So I suspect that the source of your problem is earlier, where some code incorrectly decodes some content too early. Hence the need to better understand where those chinese chars come from. Stefan