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

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

Re: How to search for characters displayed as octal codes in the buffer?


From: ken
Subject: Re: How to search for characters displayed as octal codes in the buffer?
Date: Tue, 16 Jul 2019 21:36:40 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

On 7/16/19 8:43 PM, Noam Postavsky wrote:
> On Sun, 14 Jul 2019 at 10:50, ndame <emacsuser@freemail.hu> wrote:
>> Sometimes I have unprintable characters in the buffer which display with an 
>> octal code (e.g. \232). instead of a character (text copied from elsewhere, 
>> etc.) How can I find these without knowing the exact codes?
>>
>> I'd like to find all such places in the buffer where a character appears 
>> with an octal code, but I have UTF characters too in the buffer which 
>> display properly, so using nonascii is not the answer.
> (re-search-forward "[\x80-\xff]") seems to work, though it's a bit
> awkward to enter interactively:
>
> C-M-s [ C-x 8 RET 3fff80 RET - C-x 8 RET 3fffff RET ]

The way I've been doing that is first to mark the offending text
(C-SPACE to mark one end of it, move the cursor to the other end of the
text to be replaced, then do M-w).

Move the cursor to somewhere before the text you just selected.

Do "M-x replace-string".  You're prompted for the text to be replaced,
so do "C-y" to yank in the previously selected text.  Hit Enter.

You're prompted for the text to put in it's place. Enter whatever's
appropriate and hit Enter.

This has always worked for me and I've been doing it for years.







reply via email to

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