[Top][All Lists]

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

Re: wide-char is wide

From: Hans Aberg
Subject: Re: wide-char is wide
Date: Thu, 26 Mar 2009 00:23:40 +0100

On 25 Mar 2009, at 23:30, Francisco Vila wrote:

From your kind explanation would be right to say that the argument to
the LilyPond \char command is a simple natural number and not a
multibyte utf-8 sequence? This is what --I think-- still has to be
made clear.

Everything you write out and see as a hexadecimal number on the screen is an ordinary number. In the computer, it is represented as a sequence of bytes from the ASCII set. Anything from UTF-8, if you have an editor capable of handling it, will look as just ordinary characters.

The manual says that \char #65 produces the letter "A". Here, 65 is an ordinary integer. Which position number basis? The ASCII hexadecimal number for "A" is 41, in languages like C/C++ written as 0x41, and in Unicode U+0041. What is the decimal number? In decimal, 4*16+1 = 65. What is the representation in the computer? All ASCII characters are translated as binary numbers. Since the hexadecimal form is 41, 0x4 is binary 0100, and 0x1 is binary 0001, 0x41 is binary 01000001. So 0x41 is one 8-bit byte.

So the manual is a bit short: it should say that the number is a decimal integer representing the Unicode code point.

Also, since all Unicode tables use hexadecimal numbers, there should be a convenient way to give a hexadecimal number, either as a hexadecimal-to-decimal conversion function, or a new variation of \char (with a different name).


reply via email to

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