Tuesday, January 29, 2013

Re: Windows ALT characters

On Tuesday, January 29, 2013 7:53:20 PM UTC-6, John McG wrote:
> Hi Vim,
>
> I have a load of csv files in which some rows have an arrow at the end. The arrow seems to have been made using Windows ALT 26.
>

I assume you mean somebody entered a unicode RIGHTWARDS ARROW character by holding ALT and typing 0026 in Windows on some non-Vim app.

> It shows up in Vim as ^Z^M.
>

I don't know how Vim would get these specific bytes, but you can get Vim to correctly read the character instead of getting garbage, by getting the encoding correctly.

Take a look at http://vim.wikia.com/wiki/Working_with_Unicode for a decent setup to use. You can override encoding detection with :e ++enc=utf-16 or similar if you don't see the characters correctly automatically.

I wonder if you have multiple issues here, and the ^M is not due to the arrow glyph, but rather due to line endings being detected as Unix instead of Windows. See http://vim.wikia.com/wiki/File_format

>
> Can anyone tell me how to remove these pesky objects?
>

A simple substitute should work. You can enter the ^Z (CTRL-Z) literally by typing CTRL-V followed by CTRL-Z, and similarly for the ^M (CTRL-M) character.

Your substitute should *look* like:

:s/^Z^M$//

But the ^Z and ^M are actually single bytes, not two characters.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: