Is there an escape sequence for Unicode characters?
08-27-2015, 01:57 PM
Post: #1
 StephenG1CMZ Senior Member Posts: 905 Joined: May 2015
Is there an escape sequence for Unicode characters?
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.

Stephen Lewkowicz (G1CMZ)
08-27-2015, 02:02 PM
Post: #2
 eried Senior Member Posts: 744 Joined: Dec 2013
RE: Is there an escape sequence for Unicode characters?
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"

My website: erwin.ried.cl
08-27-2015, 02:38 PM
Post: #3
 Joe Horn Senior Member Posts: 1,767 Joined: Dec 2013
RE: Is there an escape sequence for Unicode characters?
(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.

<0|ɸ|0>
-Joe-
08-27-2015, 03:52 PM (This post was last modified: 08-28-2015 07:05 AM by StephenG1CMZ.)
Post: #4
 StephenG1CMZ Senior Member Posts: 905 Joined: May 2015
RE: Is there an escape sequence for Unicode characters?
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.

Stephen Lewkowicz (G1CMZ)
08-27-2015, 06:41 PM
Post: #5
 Tim Wessman Senior Member Posts: 2,270 Joined: Dec 2013
RE: Is there an escape sequence for Unicode characters?
(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...

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
08-27-2015, 07:15 PM
Post: #6
 StephenG1CMZ Senior Member Posts: 905 Joined: May 2015
RE: Is there an escape sequence for Unicode characters?
(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?

Stephen Lewkowicz (G1CMZ)
08-27-2015, 07:18 PM (This post was last modified: 08-27-2015 07:19 PM by Tim Wessman.)
Post: #7
 Tim Wessman Senior Member Posts: 2,270 Joined: Dec 2013
RE: Is there an escape sequence for Unicode characters?
(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.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
08-27-2015, 09:09 PM (This post was last modified: 08-28-2015 01:09 PM by StephenG1CMZ.)
Post: #8
 StephenG1CMZ Senior Member Posts: 905 Joined: May 2015
RE: Is there an escape sequence for Unicode characters?
(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)

Stephen Lewkowicz (G1CMZ)
08-28-2015, 06:52 AM
Post: #9
 StephenG1CMZ Senior Member Posts: 905 Joined: May 2015
RE: Is there an escape sequence for Unicode characters?
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!

Stephen Lewkowicz (G1CMZ)
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)