On 2009-03-25, Tony Mechelynck wrote:
> On 24/03/09 22:07, mitch wrote:
> >
> > I´ve been trying to search a file for non-ascii chars using
> >
> > /[\x80-\xff]/
> >
> > and it´s not working.  How would I search for chars in the range of
> > hex 80 to hex ff?  Thanks,
> >
> > - Mitch
> 
> Try the following (both untested):
> 
> Method I.
> 
> 1) Read the file disregarding any multibyte encoding:
> 
>       :e ++enc=latin1 filename.ext
> 
> 2) Do the search
> 
>       /[<80>-ÿ]
> 
> where <80> (which, depending on your 'encoding', may appear as ~@ 
> instead) is obtained by hitting Ctrl-V x 8 0 and ÿ is a lowercase y with 
> diaeresis, which your keyboard may or may not be able to produce 
> natively. If it isn't, use Ctrl-V x F F
> 
> -- And in both cases, use Ctrl-Q instead of Ctrl-V if your Ctrl-V is 
> remapped to the paste operation.
> 
> 
> Method II (Only if 'encoding' is UTF-8).
> 
> 1) Make sure the 'fileencoding' is 8-bit
> 
>       :setlocal fenc=latin1
> 
> 2) Use the 8g8 command in Normal mode (see "help 8g8")

Mitch's original attempt works for me, in a file with
encoding=latin1 and fileencoding empty, so maybe the key is, as you
say in II 1), to make sure the 'fileencoding' is 8-bit.

Regards,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to