From: Pascal Bourguignon <pjb@informatimago.com>
Subject: Re: how to show ascii number of a character
Date: 12 Jan 2003 23:33:20 +0100 [thread overview]
Message-ID: <87k7ha6lsf.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: 87of6mmazt.fsf@orebokech.com
Romain FRANCOISE <romain@orebokech.com> writes:
> Zimmen Gnauh <yah00204052@yahoo.com> writes:
>
> > Is there any emacs function that can show a the ascii number of a
> > character? i.e. you enter a character, and it shows a number. For
> > example, enter character D, it will show 68, or in octal, binary or
> > other forms.
>
> Add this to your ~/.emacs:
>
> (defun zg-char-to-ascii ()
> "Show the ASCII number of a character."
> (interactive)
> (message (number-to-string
> (aref (read-from-minibuffer "Type a character: ") 0))))
>
> ... and do M-x zg-char-to-ascii.
>
> Cheers,
(defun show-ascii ()
(interactive)
(message "The code of the character at point is: %d" (char-after)))
In emacs, a character is an integer.
If you place the point at an ASCII character, you'll get an ASCII
code, but otherwise, it depends on the encoding currently used in the
buffer.
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
next prev parent reply other threads:[~2003-01-12 22:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-12 18:40 how to show ascii number of a character Zimmen Gnauh
2003-01-12 19:19 ` Romain FRANCOISE
2003-01-12 22:33 ` Pascal Bourguignon [this message]
2003-01-13 5:52 ` Janusz S. Bień
2003-01-16 4:55 ` Rikard Bosnjakovic
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=87k7ha6lsf.fsf@thalassa.informatimago.com \
--to=pjb@informatimago.com \
/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).