[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: how to scan file for non-ascii chars (egcut-n-paste from ms-word)
From: |
Drew Adams |
Subject: |
RE: how to scan file for non-ascii chars (egcut-n-paste from ms-word) |
Date: |
Sun, 9 Jan 2011 09:53:28 -0800 |
> > 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
Better: you can easily search incrementally for non-ascii chars, starting with
Emacs 22, like this: C-M-s [^[:ascii:]]
I just filed an Emacs bug (#7809) to get this info added to the Emacs manual.
It was added to the Elisp manual (node `Regexp Special') in Emacs 23, but
apparently it wasn't considered useful info for users. ;-) (Probably just an
oversight, actually.)
---
If you use Icicles, you can also see and search for all
sequences of non-ascii chars this way: C-` [^[:ascii]]+
`S-TAB' to see hits, `C-next' to visit them, etc.
http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview
When the set of hits is thus those defined by [^[:ascii]]+, you can type any
string using a subset of those chars (i.e., one or more particular non-ascii
chars) to narrow the hits, then visit any of those, and optionally replace any
or all of them with alternatives.
http://www.emacswiki.org/emacs/Icicles_-_Search-And-Replace
Message not available