help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to scan file for non-ascii chars (eg cut-n-paste from ms-word)


From: David Combs
Subject: Re: how to scan file for non-ascii chars (eg cut-n-paste from ms-word)
Date: Tue, 18 Jan 2011 20:06:49 +0000 (UTC)

In article <mailman.5.1294594249.11727.help-gnu-emacs@gnu.org>,
Eli Zaretskii  <eliz@gnu.org> wrote:
>> Cc: help-gnu-emacs@gnu.org
>> From: Kenneth Goldman <kgoldman@us.ibm.com>
>> Date: Sun, 9 Jan 2011 11:24:01 -0500
>> 
>> query-replace works once one has found the non-ASCII character.  However,
>> it's often not obvious where the offending text is.
>
>When Emacs asks you to select a suitable encoding, it highlights these
>characters, so you can see where they are in the buffer.
>
>> Is there a way to search for anything that isn't ASCII?
>
>If the above is not enough, then try
>
>   M-: (skip-chars-forward "\000-\377") RET
>

Nice, that skip-chars-forward:

| skip-chars-forward is a built-in function in `C source code'.
| (skip-chars-forward string &optional lim)
| 
| Move point forward, stopping before a char not in string, or at pos lim.
| string is like the inside of a `[...]' in a regular expression
| except that `]' is never special and `\' quotes `^', `-' or `\'
|  (but not as the end of a range; quoting is never needed there).
| Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter.
| With arg "^a-zA-Z", skips nonletters stopping before first letter.
| Char classes, e.g. `[:alpha:]', are supported.
| 
| Returns the distance traveled, either zero or positive.


But you're still down to doing them *one at a time*!

(If there's 200 left-right-quote pairs in a buffer, plus
who knows what else there is, isn't it sort of a pain
to use that as a way to find out what the non-ascii
chars *are*?)


David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]