You absolutely don't need to do it to use encryption (RSA or whatever). You really need to preserve encoding. All encryption algorithms work with arrays of bytes and nothing else. And this array of bytes has nothing to do with ASCII. Moreover, converting Unicode (in one or another UTF; Windows uses UTF-16LE for memory presentation of text) to ASCII means the loss of information. All your code points fit in ASCII? Possibly, but don't be so sure. Use UTF-8: it takes the same space as ASCII for all code points < 128 bit still supports all code points including 32-bit ones.
Generally, I would advise you to forget ASCII: it's gone; the ghost of it only exists as a Unicode subset. Even US English text contains code points beyond ASCII, if good typography is used. Did you know that?
So, finally, how to get that array of bytes? Simple. For example, let's assume I convinced you to use UTF-8. Then the code is:
string sourceText =
byte[] encryptionInput = System.Text.Encoding.UTF8.GetBytes(sourceText);
byte[] decryptionOutput =
string decryptedText = new string(System.Text.Encoding.UTF8.GetChars(decryptionOutput));
This is how it's done. Instead of
System.Text.Encoding.UTF8
encoding, you can use any other, even ASCII, but I strongly recommend UTF-8, by many reasons.
—SA