Re: how to scan file for non-ascii chars (eg cut-n-paste from ms-word)
From:
Kenneth Goldman
Subject:
Re: how to scan file for non-ascii chars (eg cut-n-paste from ms-word)
Date:
Sun, 9 Jan 2011 11:24:01 -0500
> From: Eli Zaretskii <eliz@gnu.org> > To: help-gnu-emacs@gnu.org > Date: 01/09/2011 09:24 AM > Subject: Re: how to scan file for non-ascii chars
(eg cut-n-paste
> from ms-word) > Sent by: help-gnu-emacs-bounces+kgold=watson.ibm.com@gnu.org >
> > From: dkcombs@panix.com (David Combs)
> > Newsgroups: gnu.emacs.help
> > Date: 8 Jan 2011 19:53:01 -0500
> >
> > When I 'cut-n-paste' from eg ms-word-produced document, into
an
> > emacs buffer (ie ascii), you get all kinds of "non-ascii"
chars,
> > eg left and right double-quotes, like these:
> >
> >
> > Char: . (8221, #o20035, #x201d) point=250 of 4096 (6%) column=7
> > Char: . (8220, #o20034, #x201c) point=218 of 4096 (5%) column=42
> >
> >
> > accents, and so on.
> >
> > When I go to save the buffer, emacs will ask if I want to
> > save it in eg japanese format. Not exactly what I want.
>
> Doesn't it suggest utf-8 as one of the possible encodings? If
so, why
> not use utf-8 and leave these characters in the file?
>
I've seen the same issue. If I'm writing source
code, I want plain ASCII, nothing unusual that a compiler or linker might complain
about.
> > What I'd like to do is change those "strange"
characters
> > to their plain-ascii "equivalent", so to speak. Like
> > '"' for double quote (left OR right), etc.
>
> Not sure why would you want that, but doesn't M-% solve this problem
> nicely? If not, why not?
query-replace works once one has found the non-ASCII
character. However, it's often not obvious where the offending text is.
Is there a way to search for anything that isn't ASCII?