From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bernd Paysan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#37633: Column part interpreted wrong in compilation mode Date: Sun, 06 Oct 2019 21:22:20 +0200 Message-ID: <13778688.nWSaQooa0N@daiyu> References: <2282407.NbK4RY0fEn@daiyu> <7240153.3ZlepMpCQE@daiyu> <83eezp1y74.fsf@gnu.org> Reply-To: Bernd Paysan Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart157042314.ShjI78uFIE"; micalg="pgp-sha256"; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="163080"; mail-complaints-to="usenet@blaine.gmane.org" Cc: anton@mips.complang.tuwien.ac.at, 37633@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 06 21:23:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHC7c-000gDf-P7 for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Oct 2019 21:23:12 +0200 Original-Received: from localhost ([::1]:36550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHC7b-0000cn-LF for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Oct 2019 15:23:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54182) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHC7U-0000cF-G1 for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2019 15:23:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHC7T-0002yo-9i for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2019 15:23:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38084) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHC7T-0002yh-7N for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2019 15:23:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iHC7S-0002kI-Bg for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2019 15:23:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bernd Paysan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Oct 2019 19:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37633 X-GNU-PR-Package: emacs Original-Received: via spool by 37633-submit@debbugs.gnu.org id=B37633.157038974710488 (code B ref 37633); Sun, 06 Oct 2019 19:23:02 +0000 Original-Received: (at 37633) by debbugs.gnu.org; 6 Oct 2019 19:22:27 +0000 Original-Received: from localhost ([127.0.0.1]:46905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHC6t-0002j6-HY for submit@debbugs.gnu.org; Sun, 06 Oct 2019 15:22:27 -0400 Original-Received: from mail.net2o.de ([185.183.156.191]:53774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHC6r-0002iw-L4 for 37633@debbugs.gnu.org; Sun, 06 Oct 2019 15:22:26 -0400 Original-Received: from daiyu.localnet (200116b826959f009a939674d530470e.dip.versatel-1u1.de [IPv6:2001:16b8:2695:9f00:9a93:9674:d530:470e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.net2o.de (Postfix) with ESMTPSA id 55558400A4; Sun, 6 Oct 2019 21:22:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=net2o.de; s=mail; t=1570389744; bh=Whye8hHOqTh3FmBkcqLym4bKAdQIrbFV608qBv1Y9O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/eKlC6diOdc27O37nb70iRzbjsdr5rwfmyr2PenKuh3ExpoT05jVy8uB4DvRnvck VHI5qrHcZJNmsiZ2AiG4lKNJ3SegLBKMGWK+3R0ryR/pMWN1zfWErLSNaW3q2jlPcY u5b+YDIZOhiKA2QQ26xhYNwBLG163M0/33Tjhvzo= In-Reply-To: <83eezp1y74.fsf@gnu.org> 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:168456 Archived-At: --nextPart157042314.ShjI78uFIE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Am Sonntag, 6. Oktober 2019, 21:16:47 CEST schrieb Eli Zaretskii: > > From: Bernd Paysan > > Cc: anton@mips.complang.tuwien.ac.at, 37633@debbugs.gnu.org > > Date: Sun, 06 Oct 2019 21:02:14 +0200 > >=20 > > if the editor mistook a UTF-8 file for an iso8859-1, it will see an > > UTF-8 string "=C3=A4=C3=B6=C3=BC" (6 bytes UTF-8) as "=C3=83=C2=A4=C3= =83=C2=B6=C3=83=C2=BC" (6 bytes iso8859-1). > > But it's still 6 bytes. >=20 > Not inside the Emacs buffer, it isn't. I created a unicode file: void main() { char *b=3D"ha", *c=3D"ho"; printf("test %i", b); printf("test=C3=A4=C3=B6=C3=BC %i", c); } I loaded this into emacs, and reverted the buffer using iso8859-1 coding=20 (simulating a wrongly detected encoding). It then looks like this: void main() { char *b=3D"ha", *c=3D"ho"; printf("test %i", b); printf("test=C3=83=C2=A4=C3=83=C2=B6=C3=83=C2=BC %i", c); } I compiled it with gcc -Wall test-utf8.c into a compile-mode buffer. =2D*- mode: compilation; default-directory: "~/tmp/" -*- Compilation started at Sun Oct 6 21:18:24 gcc -Wall test-utf.c=20 test-utf.c:1:6: warning: return type of =E2=80=98main=E2=80=99 is not =E2= =80=98int=E2=80=99 [-Wmain] 1 | void main() { | ^~~~ test-utf.c: In function =E2=80=98main=E2=80=99: test-utf.c:3:2: warning: implicit declaration of function =E2=80=98printf= =E2=80=99 [- Wimplicit-function-declaration] 3 | printf("test %i", b); | ^~~~~~ test-utf.c:3:2: warning: incompatible implicit declaration of built-in=20 function =E2=80=98printf=E2=80=99 test-utf.c:1:1: note: include =E2=80=98=E2=80=99 or provide a decl= aration of =E2=80=98printf=E2=80=99 +++ |+#include 1 | void main() { test-utf.c:3:16: warning: format =E2=80=98%i=E2=80=99 expects argument of t= ype =E2=80=98int=E2=80=99, but=20 argument 2 has type =E2=80=98char *=E2=80=99 [-Wformat=3D] 3 | printf("test %i", b); | ~^ ~ | | | | int char * | %s test-utf.c:4:22: warning: format =E2=80=98%i=E2=80=99 expects argument of t= ype =E2=80=98int=E2=80=99, but=20 argument 2 has type =E2=80=98char *=E2=80=99 [-Wformat=3D] 4 | printf("test=C3=A4=C3=B6=C3=BC %i", c); | ~^ ~ | | | | int char * | %s Compilation finished at Sun Oct 6 21:18:24 If I click on the test-utf.c:4:22 label, I get exactly where I want to: On = the=20 i of %i. If I revert this buffer with the correct encoding utf-8-unix, then it still= =20 navigates to the i of %i, so it's all agnostic to whether the encoding=20 detected was correct or wrong. =2D-=20 Bernd Paysan "If you want it done right, you have to do it yourself" net2o id: kQusJzA;7*?t=3Duy@X}1GWr!+0qqp_Cn176t4(dQ* https://net2o.de/ --nextPart157042314.ShjI78uFIE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEERJ1NDqPQRwYnwBjr9y2Uk5MtoGcFAl2aPuwACgkQ9y2Uk5Mt oGfPKw//Qc5EBYXHJaKr5E1AH0tstzyzHJCPLLhssU99ieMHX8tgoLKgfQaC0AYS mykOrbXTnTBluvUw40DHWmG6P0RBiZ/vJ/sUVBr1WQ7Sw3zbh9+2kq6qT+wPToSU w7diL3gXxnfqFMNtR7Fq6/5ZOtf9Dh9zjdwwNjWuSvRWhwsNKPnGdFX10phzdaKJ 8znzlZlrZFcpFyuUtdbkGIQHWk7uPaIZaBxuaRN4eTuAm1UbkPiLPUGdHTFsLZDx RVHOFO0ImTiy0soG+gACF2txsyf7eSjTgN9T13FJtV+nqGOlpZXO7h+z2Zhke1lh iCc/C/mf9Jb/mSIf4AgowKMVPrKkIOXRTcH3C525wup9tChZ0zkhDr9iZXwJW2xU 9ttnA5MESc17bzPr4lAuoguQQNUgDX8sJbTDQWrE8VvG+a0VmCQtqpz4TjaLmhU0 npO945O/qXDAlsewWkCaiPTrJjopjIGSMtmpOB0TztAH7zfGODxIR31kZ/4jtOxi vcaeSWAKy9sOG4pXoA21Ow0PQBYD4Nb8gdURCprPtO24AZsdPHiIeq2mUlN9WltE cOSHps1hSKJXEUpMpcFFl2a3nCkCgIEBmFwoiI3plSXgsdiMHn4tJ7SCcI0oqyDI A47c6bsBECy4g8ueaSj+k+vQ5tk0OI9/QllLHMWgst/UtbZirtw= =Ta0r -----END PGP SIGNATURE----- --nextPart157042314.ShjI78uFIE--