From: harven <harven@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: Finding and mapping all UTF-8 characters
Date: Sat, 05 Dec 2009 21:29:47 +0100 [thread overview]
Message-ID: <m2ocmdb1vo.fsf@free.fr> (raw)
In-Reply-To: da535e83-3eec-429c-b63e-f304cc1f2dd3@n13g2000vbe.googlegroups.com
deech <aditya.siram@gmail.com> writes:
> Hi all,
> I recently cut-and-pasted large chunks of text into an HTML document.
> When I tried to save the document I was warned that it was ISO-Latin
> but there were UTF-8 characters in the text.
The warning actually contains a list of these characters, and you can click
on them to see where they are located in the buffer.
> Is there a way to (1) search for the UTF-8 encoded characters in a
> document and (2) map them to a sensible ASCII character?
>
> Thanks ...
> -deech
Instead of converting to latin-1, it is probably better to save the file
in another coding system. Just do
M-x set-buffer-file-coding-system RET utf-8 RET
On the other hand, if you were surprised by the unicode characters,
then this probably means that there are few of them. Have a look at
the iso-cvt.el package for setting a conversion table.
The command iso-sgml2iso is pretty close to what you want.
Now, if you want to search a buffer for all characters belonging to
some category, you can use a regexp.
\ca matches any ascii characters (newlines excluded). Same as [[:ascii:]].
\Ca matches any non-ascii characters (newlines included).
\cl matches any latin characters (newlines excluded).
\Cl matches any non-latin characters (newlines included).
So the following command copies all non-latin characters to the scratch buffer.
M-x replace-regexp RET \Cl RET \,(princ \& (get-buffer "*scratch*"))
prev parent reply other threads:[~2009-12-05 20:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-05 16:03 Finding and mapping all UTF-8 characters deech
2009-12-05 16:38 ` Pascal J. Bourguignon
2009-12-05 18:40 ` Peter Dyballa
2009-12-05 20:29 ` harven [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2ocmdb1vo.fsf@free.fr \
--to=harven@free.fr \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).