How can I retain carriage returns when I'm encrypting data?

Posted by William Calleja on Stack Overflow See other posts from Stack Overflow or by William Calleja
Published on 2010-04-09T10:20:04Z Indexed on 2010/04/09 10:23 UTC
Read the original article Hit count: 363

Filed under:
|
|
|
|

I have this following setup, a textarea named with some data in it that may have carriage returns and another textarea that has style='display:none' in order to make it hidden as follows:

<textarea id="myTextarea" onBlur="encryptMyData()"></textarea>
<textarea name="encryptedText" style='display:none'></textarea>

the user enters data in the first textarea and when that text area loses focus the 'encryptMyData()' javascript function is calling an ajax call to take whatever the user entered in the first textfield, encrypt it using rijndael, and paste it in the encryptedText textarea so that it is stored in the database later.

Now what I need to do is this, find a way to convert the carriage returns before encryption to a tag like so [cr] so that when I retrieve the data, all formatting is retained. Any idea how I do this? I'm using asp.net and c# to perform the encryption.

© Stack Overflow or respective owner

Related posts about rijndael

Related posts about JavaScript