HP Forums

Full Version: Is there an escape sequence for Unicode characters?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For example, if I wanted to print a pack of playing cards, I would like to be able to do
For I from 1 to 52 print("/u"+I)
(Plus whatever offset the first card is at).

So far all the ways I have tried just print the /u as text rather than recognising it as Unicode.

The alternative of using shift/chars and manually selecting each of the 52 cards works fine, but is tedious.

Apologies if this is covered in the manual. My reader forgets what it is searching for after the first couple of pages.
Code:
Syntax: CHAR(list or vector) or CHAR(integer)

Returns the string corresponding to the ASCII character codes in vector, or the single character associated with integer.

Example: CHAR(65) returns "A" and CHAR({82, 77, 72}) returns "RMH"
(08-27-2015 01:57 PM)StephenG1CMZ Wrote: [ -> ]For example, if I wanted to print a pack of playing cards, I would like to be able to do
For I from 1 to 52 print("/u"+I)
(Plus whatever offset the first card is at).

So far all the ways I have tried just print the /u as text rather than recognising it as Unicode.

The alternative of using shift/chars and manually selecting each of the 52 cards works fine, but is tedious.

Apologies if this is covered in the manual. My reader forgets what it is searching for after the first couple of pages.

Unfortunately, the Unicode "Playing Card" characters are code points 0x1F0A1 through 0x1F0DE, which do not exist in the Prime Sans font. So you'll have to combine existing characters to create playing cards, e.g. CHAR({65,9824}) creates "A♠" (Ace of Spades). Characters 9824 through 9827 are the normal suit characters, and 9828 through 9831 are their inverse-video versions.
Thanks, that helps. Now how do I express that in hex?
Most Wikipedia sources use hex, eg 1F060h is a domino.
I've tried PRINT(CHAR(#1F06h)).
I've tried PRINT(CHAR(SETBASE(#1F06h,3))), which returns a decimal rather than a hex

Have I just done a typo or am I missing something?
I know the symbol is available if I pick it up manually, but using numbers the best I am seeing is the no-such-symbol-rectangle.

typo here only : 1f06 should be 1f060.
(08-27-2015 03:52 PM)StephenG1CMZ Wrote: [ -> ]I've tried PRINT(CHAR(#1F06h)).
[...]
I know the symbol is available if I pick it up manually, but using numbers the best I am seeing is the no-such-symbol-rectangle.

Nothing is wrong there. As Joe stated, those characters don't exist in the font. In addition, we only support characters up to FFFF and nothing higher. In addition, even if those characters were there they would not be very legible at all due to the high information density and lower resolution screen.

You will need to use two separate characters as joe stated. CHAR({65,9824}) for example...
(08-27-2015 06:41 PM)Tim Wessman Wrote: [ -> ]
(08-27-2015 03:52 PM)StephenG1CMZ Wrote: [ -> ]I've tried PRINT(CHAR(#1F06h)).
[...]
I know the symbol is available if I pick it up manually, but using numbers the best I am seeing is the no-such-symbol-rectangle.

Nothing is wrong there. As Joe stated, those characters don't exist in the font. In addition, we only support characters up to FFFF and nothing higher. In addition, even if those characters were there they would not be very legible at all due to the high information density and lower resolution screen.

You will need to use two separate characters as joe stated. CHAR({65,9824}) for example...

If the character is not available, fair enough - Unicode has so many!

But when I do shift/char I can see (after scrolling down), select and print a domino - it's just when entering the hex number I'm having a difficulty.
Perhaps the shift/char table has something that looks like a domino but at a different number?
(08-27-2015 07:15 PM)StephenG1CMZ Wrote: [ -> ]But when I do shift/char I can see (after scrolling down), select and print a domino - it's just when entering the hex number I'm having a difficulty.
Perhaps the shift/char table has something that looks like a domino but at a different number?

In the bottom right corner of the chars browser (just above the OK menu key) you have both the hex and decimal. So either use the top one in the form of #<top>h, or just the bottom one as written, or #<bottom>d if you so desire as input to the CHAR command.
(08-27-2015 07:18 PM)Tim Wessman Wrote: [ -> ]
(08-27-2015 07:15 PM)StephenG1CMZ Wrote: [ -> ]But when I do shift/char I can see (after scrolling down), select and print a domino - it's just when entering the hex number I'm having a difficulty.
Perhaps the shift/char table has something that looks like a domino but at a different number?

In the bottom right corner of the chars browser (just above the OK menu key) you have both the hex and decimal. So either use the top one in the form of #<top>h, or just the bottom one as written, or #<bottom>d if you so desire as input to the CHAR command.

Thanks - that works. Using the number Shown on the table displays the symbol. For whatever reason the domino number wasn't the one listed in Wikipedia (page about dominoes, not Unicode). But I know Unicode has several instances of symbols.

Those numbers are very small (I am using a small Android, less than 5in).
Any chance of a "magnifying glass" feature? That would also help with seeing the buttons more easily.
(Update: Android's accessibility magnification is sufficient)
just to explain why I thought I saw a domino in the character table, but others said it wasn't in the character set (and why the number given by the character table wasn't the one in Wikipedia):

The one I was seeing in the character table was actually the face of a dice or half a domino.
Still, that's good enough to use - I just need two of them.
Or it would be good enough to use, if only I could make them bigger!
Reference URL's