[Top][All Lists]

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

Re: Fwd: Re: Inadequate documentation of silly characters on screen.

From: Stefan Monnier
Subject: Re: Fwd: Re: Inadequate documentation of silly characters on screen.
Date: Thu, 19 Nov 2009 15:02:22 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> No: the string does not contain any characters, only bytes, because it's
>> a unibyte string.
> I'm thinking from the lisp viewpoint.

So am I.  Lisp also manipulates bytes sometimes.  What happens is that
you're working mostly on a major mode, so you mostly never deal with
processes and files, so basically your whole world is (or should be)
multibyte and you never want to bump into a byte.

> I really don't want to have to think about the difference between
> "chars" and "bytes" when I'm hacking lisp.

When you write code that gets an email message via a connection to an
IMAP server, you have no choice but to care about the distinction
between the sequence of bytes you receive and the sequence of
chars&images you want to turn it into.  That's true for any language,
Elisp included.

> If I do, then the abstraction "string" is broken.

Not sure in which way.

>> So it contains the byte 241, not the character ñ.
> That is then a bug.  I wrote "(aset nl 0 ?ñ)", not "(aset nl 0 241)".

?ñ = 241 = #xf1 = #o361

There is absolutely no difference between the two expressions once
they've been read: the reader turns ?ñ into the integer 241.

>> The byte 241 can be inserted in multibyte strings and buffers because
>> it is also a char of code 4194289 (which gets displayed as \361).

> Hang on a mo'!  How can the byte 241 "be" a char of code 4194289?  This
> is some strange usage of the word "be" that I wasn't previously aware
> of.  ;-)


> At this point, would you please just agree with me that when I do

>    (setq nl "\n")
>    (aset nl 0 ?ñ)
>    (insert nl)

> , what should appear on the screen should be "ñ", NOT "\361"?  Thanks!

I have already agreed.


reply via email to

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