bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] hexcodes to unicode points


From: Jay Foad
Subject: Re: [Bug-apl] hexcodes to unicode points
Date: Fri, 28 Oct 2016 10:16:00 +0100

The rows of 13 4 ⍴ idx show the individual bytes of the UTF-8 encoding of some characters. Convert to text with e.g.:

      19 ⎕CR ⎕UCS 226 141 186 226 141 181
⍺⍵

To convert the other way:

      ⎕UCS 18 ⎕CR cards
240 159 130 168 240 159 130 166 ...

Jay.

On 28 October 2016 at 06:10, <address@hidden> wrote:
hi bugapl,

I'm getting a bit confused, and would appreciate help.

I'm trying to pass cards to a webserver, but GET and POST percent-encode values.

I have this code that converts the text-hex to decimal values.

cards←'🂨🂦🂻🂷🂴🂲🃝🃘🃒🃋🃊🃆🃄'
      hexcodes←,¨,(16 1 ⍴'0123456789ABCDEF')∘., (⍪¨'0123456789ABCDEF')
      hand←"%F0%9F%82%A8%F0%9F%82%A6%F0%9F%82%BB%F0%9F%82%B7%F0%9F%82%B4%F0%9F%82%B2%F0%9F2%B2%F0%9F%83%9D%F0%9F%83%98%F0%9F%83%92%F0%9F%83%8B%F0%9F%83%8A%F0%9F%83%86%F0%9F%83%84"
      handpart←1↓¨(+\hand='%')⊂hand
      idx←hexcodes⍳handpart
            13 4 ⍴idx
241 160 131 169
241 160 131 167
241 160 131 188
241 160 131 184
241 160 131 181
241 160 131 179
241 160 132 158
241 160 132 153
241 160 132 147
241 160 132 140
241 160 132 139
241 160 132 135
241 160 132 133

 ⎕ucs cards
127144 127142 127163 127159 127156 127154 127197 127192 127186 127179 127178 127174 127172

not sure how to link the rows of 13 4 ⍴ idx with ⎕ucs cards. Any suggestions before I dove into RFCs?

-Alex


reply via email to

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