From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68971: Innocent file renders crazy Date: Thu, 08 Feb 2024 08:03:01 +0200 Message-ID: <86il2zxzl6.fsf@gnu.org> References: <0d2a32d084f32d24679c28ef972f50fd@jidanni.org> <8634u4z5du.fsf@gnu.org> <87mssceymc.5.fsf@jidanni.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38081"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68971-done@debbugs.gnu.org To: Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 08 07:04:14 2024 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 1rXxWA-0009f4-EG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Feb 2024 07:04:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXxVm-0007fH-Au; Thu, 08 Feb 2024 01:03:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXxVk-0007bv-G3 for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 01:03:48 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXxVk-0007gZ-8A for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 01:03:48 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXxVy-0008Q5-DO for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2024 01:04:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Feb 2024 06:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 68971 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 68971@debbugs.gnu.org, eliz@gnu.org, jidanni@jidanni.org Original-Received: via spool by 68971-done@debbugs.gnu.org id=D68971.170737220632305 (code D ref 68971); Thu, 08 Feb 2024 06:04:02 +0000 Original-Received: (at 68971-done) by debbugs.gnu.org; 8 Feb 2024 06:03:26 +0000 Original-Received: from localhost ([127.0.0.1]:58808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXxVO-0008Oy-CL for submit@debbugs.gnu.org; Thu, 08 Feb 2024 01:03:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXxVM-0008Ol-Ro for 68971-done@debbugs.gnu.org; Thu, 08 Feb 2024 01:03:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXxV3-0007L2-7N; Thu, 08 Feb 2024 01:03:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JoR12PWN7piEDfd2prns1+oPJNkAGTU1UucJ6XLzGvc=; b=J3AHE+U2J4Cz CB7mYsB5Qaj1P3dYgzoOflzE31f0dbqYfrbKJ81lnym/xUt4685X28vX9rN+vO4CacIYHTTltBcrt qzy0uQirOdMURD94BC5vdlok3L8RAnionD3aEUmbqdEznQUCOzDuPztN3o+GPq35xC8uvG4NRqj3v PZCSadYZsTmpfLOTzPlwuGmI/8lSs8011UIV8woKDUCD/sJuWA3cDFRGPG1QkjTVaDOCcuO4L7zs5 DfC6CaK5UIUdjVNrZWGC1OdXZj41c25xvZ9ofNZRMuhdjRTJz/zHfW0DJ6Pmq9nY6QPYFAgkeOXFQ hOjEJgoo1xRQDl/jxPE5dQ==; In-Reply-To: <87mssceymc.5.fsf@jidanni.org> (message from Dan Jacobson on Thu, 08 Feb 2024 05:46:35 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279595 Archived-At: > From: Dan Jacobson > Cc: 68971@debbugs.gnu.org > Date: Thu, 08 Feb 2024 05:46:35 +0800 > > OK, you are entirely right. It is all the file's fault and not emacs's. > > But on the other hand I wouldn't get far telling the Google Chrome team > they should stop overriding charset declarations just to make things > render good. > > In the end it's the emacs users who end up not being able to read the > document. > > Maybe have some warning "wrong charset detected, proceed? [y,n,(a)utofix...]" How can Emacs know, up front, that the charset is wrong? In general, when a file claims some specific charset or encoding, Emacs believes that and obeys. The "gibberish" is in the eyes of the beholder; Emacs doesn't really understand human-readable text, and so doesn't know whether what it presents is legible text or garbage caused by wrong decoding. > Else well, all the other users in the room are proceeding with their > homework assignment, except Ralph, who uses emacs, which has gibberish > on its screen, with no warnings. What I did when I saw gibberish was to visit the file literally (as in "M-x find-file-literally"), then, when I saw it was plain ASCII, looked at its preamble, where I saw UTF-16, which explained why "C-x C-f" shows gibberish. So when something like this happens, my suggestion is: . M-x find-file-literally . look at the literal display: if its is readable, you can just proceed with your home assignment . alternatively, force Emacs to visit with the correct encoding, as in "C-x RET c utf-8 RET C-x C-f metadata.html RET" The "utf-8" part above was a guess, based on looking at the file when visited literally; you may need to guess again if the results are not good enough. See the node "Text Coding" in the Emacs user manual for more about these facilities. And with that, I'm closing this bug.