Reply to message «Behaviour of char2nr() and nr2char()», 
sent 01:37:37 12 July 2011, Tuesday
by Christian Brabandt:

Yes, it is what should happen (how do you imagine converting a character to its 
code in this case?). And yes, it should be mentioned in help because in :h /. 
(and a number of other places like :h x) and in :h char2nr() word «character» 
has different meaning while :h mbyte-combining uses the same meaning of 
«character» as in :h char2nr(). :h mbyte-combining also does not define clearly 
where «character» has what meaning (only «mostly considered part of the 
preceding character» with one example).

Original message:
> Bram,
> I have a question: The documentation for char2nr() says:
> 
> ,----
> 
> | char2nr({expr})                                             *char2nr()*
> | 
> |             Return number value of the first char in {expr}.
> 
> `----
> 
> That is fine with me, except, that when using combining chars, I get
> unexpected results.
> 
> If I use this character:
>  ü
> which is U+0075 U+0308 (LATIN SMALL LETTER U WITH COMBINING DIAERESIS),
> yank that char into a register and use char2nr() with that register I
> get only the numeric value for LATIN SMALL LETTER U which is 117.
> Except, that I can't use nr2char again to get the small umlaut back
> again.
> 
> Is that what is supposed to happen? If it is, than is should at least be
> mentioned in the help, I think.
> 
> regards,
> Christian

Attachment: signature.asc
Description: This is a digitally signed message part.

Raspunde prin e-mail lui