Accented and special charcters

Hello,
maybe a stupid question.
In a TextArea I type the following. “È tutto”; I save it via BinaryStream and everything works (as far as saving) but when I open it I get “�� tutto”.
The computer language is set to italian, why don’t I get the accented E but 2 �� ?

Open it? Open it how?

Sorry, from a code in a pushbutton that reads the specific binaryStream, It puts the sentence in the right TextArea but the accented characters are wrong

To answer the question you’ve asked, Encodings.

I gave a talk on this at XDC a few years ago that might help you understand the issue.

1 Like

The short answer is, when you read from a BinaryStream, the code sees raw bytes. You have to use DefineEncoding to tell it how to interpret those bytes so it can show the characters they are meant to represent.

Funny. I tried and this is what I got (UTF16): 裃甠慮瀠潲慶

And with DefineEncoding(Encodings.UTF8) you get?

It works. I tried UTF16 because I was not sure UTF8 had accented characters.

Thanks for your help

UTF8 supports everything that UTF16 does. Well almost, some variants only support 1, 2 and 3 byte codes missing some emoji out. I’m not sure if Xojo supports the 4 byte characters.

You could guess that it does (and a large number of eastern asian languages too, from the fact that most websites across the world are UTF-8 (97.9%, in fact). See:

Thank you everybody for your help

Have a good day/night (depending where tou are)

1 Like