From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: how to find encoding violations in Emacs buffer? Date: Tue, 12 Dec 2006 17:45:15 -0600 Organization: UseNetServer.com Message-ID: References: <1165947493.201071.294760@l12g2000cwl.googlegroups.com> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1165970515 27039 80.91.229.10 (13 Dec 2006 00:41:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Dec 2006 00:41:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 13 01:41:53 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GuIBw-00064d-Rm for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Dec 2006 01:41:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GuIBs-00005F-6x for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Dec 2006 19:41:44 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!208.49.83.146!uns-out.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!DIALUPUSA.NET!not-for-mail Original-Newsgroups: gnu.emacs.help X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-X-Complaints-To: abuse@usenetserver.com Original-Lines: 47 Original-X-Trace: a0be7457f3f1da13a03c621032 Original-Xref: shelby.stanford.edu gnu.emacs.help:143882 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39487 Archived-At: "Lennart Borgman" wrote in message news:mailman.1801.1165956001.2155.help-gnu-emacs@gnu.org... > riccardo.murri@gmail.com wrote: > > Hello, > > > > from time to time, a buffer gets some spurious character in and Emacs > > refuses to save it in the correct encoding. So I am presented with the > > choice of other different encodings. > > > > However, in most of the cases, I know that the file *should* be UTF-8 > > encoded. So I would rather like to find out where the offending > > character is and correct it, instead of choosing a different encoding. > > > > Is there any function/package/elisp hack to find/highlight characters > > in a buffer that Emacs could not encode as UTF-8? > > > > Thank you for any hint! > > > > Riccardo > > > > P.S. Currently running 22.0.90 > > > > I think someone said there was, but I have never seen it though I have > had these problem quite often. Can't remember the details now. > > Which platform are you on? I am using MS Windows (2000 or XP). > > I also use utf-8 almost all the time (dos coding system for text files to be used in the w32 environment, e.g. batch files, etc.) For files written by and read back into w32 Emacs, I think that it's important to distinguish between characters that are not displayed due to the lack of a glyph in the font(s) [shown as hollow rectangles, solid rhombs, question marks] and those missing because of some incompatibility between character mappings [I think these are shown as escaped octal sequences that result from differences in national character sets in the range just above ascii (128-255)]. I have always been able to fix these with M-%. If you can find tables of these extended characters from the various European languages, it should be fairly easy for someone (not me) to cobble together an elisp routine to deal with this problem. I would guess that 10 or 20 of these characters account for more than 99% of the mismappings. Ed