C# WFA How to write non-ascii characters on maskedTextBox?

  • Thread starter Thread starter Excaliburr
  • Start date Start date
E

Excaliburr

Guest
I'm using TripleDESCryptoService and I keep the encrypted text in byte[]. I want to display this on a textBox. So I choose AsciiOnly = False for maskedTextBox. Now I copy a non-ascii character and paste it on maskedTextBox and there is no problem. But when I do it in code it fails.

Example text to write and what it displays:

ÊĞ9z –4àO$&ê\±"
��9z �4�O$&�\�"

If it's not an ascii character, it displays a question mark. But as I said, if I manually copy and paste it in maskedTextBox, it displays all the characters as it should be.

Here is what I've already tried:

maskedTextBox1.Text = Encoding.UTF8.GetString(bytes);

maskedTextBox1.Text = Convert.ToBase64String(bytes);


Continue reading...
 

Similar threads

Back
Top