Individual char values in a Unicode string

T

Tim Bray

I'm trying to figure out how to use [] String or jconv or something =
=20
to figure out the actual code-point values in a Unicode/UTF-8 =20
string. For example, how can I write f such that

f('t=C3=B6=E4=B8=AD') =3D=3D> [ 0x74, 0xf6, 0x4e2d ]

(hex just for clarity of course, I want numbers).

-Tim
 
D

Daniel Berger

Tim said:
I'm trying to figure out how to use [] String or jconv or something to
figure out the actual code-point values in a Unicode/UTF-8 string.
For example, how can I write f such that

f('tö中') ==> [ 0x74, 0xf6, 0x4e2d ]

(hex just for clarity of course, I want numbers).

-Tim

'tö中'.unpack("U*") => [116, 246, 20013]

Regards,

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top