Please! Help me with some String-ninja-work


#1

Hi

Hoping someone can help with this one, as I’m not totally up and running with how Juce handles different string types.

I need to control an old text machine.

This old thing wants text via the com-port, and as far as I can tell it wants it as ascii.

I now send the text like this

outStream->write(txt.getCharPointer(), txt.getNumBytesAsUTF8());

This works fine.

But, now I need to support “special character” like Æ,Ø,Å. Etc

Because of the way the text machine works, I need to replace these characters in my String with two special bytes/characters so:

“Æ” becomes the two bytes 0x08 0x4d.

How can I replace the special characters with the escape bytes?

Will the Juce string mess up these bytes, what are my options?