Looping over non-UTF-8 characeters

Hey,
I’m writing a little environment for generating graphical scores and I was wondering if there is any straight forward way to generate non-UTF-8 characters from SuperCollider.
I managed to narrow down my problem to the following code:

This code executes well:

(
a = "qwertyui";
o = [];
a.do{|e|o = o.add(e)};
o;
)
-> [ q, w, e, r, t, y, u, i ]

and produces the expected outcome.
BUT this code:

(
b = "Œ„´‰ˇÁ¨ˆØ";
o = [];
b.do{|e|o = o.add(e)};
o;
)
-> [ �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, �, � ]

doesn’t really return anything useful.
If turned into ascii:

(
b = "Œ„´‰ˇÁ¨ˆØ";
o = [];
b.ascii.do{|e|o = o.add(e)};
o.asAscii;
)
-> Œ„´‰ˇÁ¨ˆØ

is there any easier way? Currently I’m using a lookup table for changing placeholder strings into non-UTF8 characters and it would be great, if I wouldn’t need to go the extra mile…

Best
Sem

Hey,

you could try using the Strang Quark:

Quarks.install("Strang"); thisProcess.recompile;

(
b = "Œ„´‰ˇÁ¨ˆØ".asStrang;
o = [];
b.do{|e|o = o.add(e)};
o;
)

all best!

1 Like

This might be helpful as well: unicode Strings · GitHub

Slightly different approach vs Strang. This is somewhat minimally tested…

great, thanks! I will check out both!