Unicode Encoding / Encryption RSA

S

Shahid

Hi,


I am trying to display the encrypted value on the console. When I use
the following

UnicodeEncoding encoding = new UnicodeEncoding( );
string constructedString = encoding.GetString(encryptedData);

And I print constructedString on to the console, I see "??????" When I
do a debug, I see boxes. But if I put a watch on the variable (on the
encrypteddata), see the hex values.

What I want to do is display the hex value on the screen.

Any help would be greatly appreciated.


Thanks,
Shahid
 
N

Nicholas Paldino [.NET/C# MVP]

Shahid,

Is it possible that the font that is being used for the console doesn't
support unicode characters (it might only support ascii characters, which is
why you are getting the ?????).

I would change the font on the console to one that can support these
characters.

Hope this helps.
 
J

Jon Skeet [C# MVP]

Shahid said:
I am trying to display the encrypted value on the console. When I use
the following

UnicodeEncoding encoding = new UnicodeEncoding( );
string constructedString = encoding.GetString(encryptedData);

That's a bad idea. That's treating opaque binary data as if it were
encoded text.
What I want to do is display the hex value on the screen.

Use BitConverter.ToString(byte[])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top