jjmerelo
jjmerelo

Reputation: 23537

Combining characters using their hexa name

This works:

say "\c[COMBINING BREVE, COMBINING DOT ABOVE]"  # OUTPUT: «̆̇␤»  

However, this does not:

say "\c[0306, 0307]"; # OUTPUT: «IJij␤»

It's treating it as two different characters. Is there a way to make it work directly by using the numbers, other than use uniname to convert it to names?

Upvotes: 6

Views: 102

Answers (2)

jjmerelo
jjmerelo

Reputation: 23537

\c uses decimal numbers:

say "\c[774, 775]"

where 774 is the decimal equivalent of 0306, works perfectly.

Upvotes: 5

Brad Gilbert
Brad Gilbert

Reputation: 34120

The \c[…] escape is for declaring a character by its name or an alias.
0306 is not a name, it is the ordinal/codepoint of a character.

The \x[…] escape is for declaring a character by its hexadecimal ordinal.

say "\x[0306, 0307]"; # OUTPUT: «̆̇␤»

(Hint: There is an x in a hexadecimal literal 0x0306)

Upvotes: 9

Related Questions