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

Re: Vim highlight high-ascii characters?



On Mon, Mar 19, 2007 at 04:02:51PM -0400, Mitch Wiedemann wrote:
> Hi all,
> 
> I'm wondering is anyone knows how I can configure my Vim (7.0) to
> highlight ASCII characters outside of the 0-128 range.
> 
> I mostly write PHP/XHTML, and sometimes I have to copy content from word
> processed documents, and that sometimes inserts odd, but otherwise not
> visually detectable characters (like strange m-dashes, dashes, and
> single-quotes).
> 
> Is there a way I can have these sorts of characters highlighted so I can
> replace them with their HTML counterparts?
> 
> Thanks in advance.  I'm not currently subscribed to the Vim user list,
> or I'd ask them. :)

As ASCII is only 7 bits, which makes for a maximum of a 128 character
set, what you ask for doesn't exist.  (see man ascii)

(continuing to reference man ascii)

The linux default 8-bit character set is 8859-1.  I suppose it depends
on what character set you're using vs what character set the word
processor was using.

I'm sorry to hear that the word processor is broken :)

I'm sure there is a way to do what you ask; computers can do anything
you tell them to do; vim can do anything.  

What about writing a filter to remove such codes from the file before
you bring it into vim?  If all you want is ASCII, it should be trivial
to reject with sed.  Hopefully someone who knows sed can give you a
recipe.  

Then again, the same recipe can probably be coded as a vim macro, but
I'd rather know that the contents of a file are clean before I bring it
into a document I'm working on.

Good luck,

Doug.



Reply to: