Setting TextEncoding of a TextArea

Hi Everyone,

Probably a dumb question but how can I permanently set the TextEncoding of a TextArea, I use the following when the TextArea is first opened, and I do want it in ASCII encoding.

taArea.Text = ConvertEncoding(taArea.Text, Encodings.ASCII)

But the moment I start typing the Encoding changes because the quotes change to slanted quotes not straight quotes. I convert it to ASCII again when I process it but it’d be nice if it stayed that way all the time. I have styled text turned off on the TextArea as well.

Regards

Trig

I imagine the encoding is changing because the text that is being typed is UTF-8 which causes the encoding of the text area to change.

To keep the encoding as ASCII you would probably have to try to limit what characters get added to the text area when text is typed or pasted. This could be very difficult to implement reliably.

Can you tell us the reason why you need the encoding to stay as ASCII?

Text in a text area is hold by the control in whatever format it prefers.

For macOS this is UTF-8 and for Windows UTF-16.

When you assign, text is converted and on the way out converted to UTF-8.

Thanks Everyone,

Not really that much of an issue really. I just convert it to ASCII before passing it through a text passer, and it’s far easier to process what I’m doing in ASCII than anything else. I don’t need to save it out to a file so for the moment okay.

Thanks

Trig