Subject | Re: Varchar with #0 char in it |
---|---|
Author | gsndelphicoder |
Post date | 2008-03-18T17:06:44Z |
I ran into this problem and just created functions called
FormatEncrypt and FormatDecrpyt which basically replace special
characters that don't save well with an a code based on the ascii code.
As an example I would encrypt the data and pass the encrypted string
to the FormatEncrypt function that would cycle through every character
in the string and replace the ascii characters I have found to be
problematic (#0 - #31,#34,#39,#96,#127 - #159,#180) with a text
representation of that code. Your #0 would be replaced with 'AI0 ' ('
denotes the beginning and ending of a string).The string can then be
saved to the DB.
When it is retrieved from the DB it is passed to the FormatDecrypt
function which cycles through the characters looking for the ascii
code replacement strings and replaces them with the corresponding
ascii character. The 'AI0 ' would be replaced with #0. The string
can now be passed to be decrypted.
Hope this helps!
FormatEncrypt and FormatDecrpyt which basically replace special
characters that don't save well with an a code based on the ascii code.
As an example I would encrypt the data and pass the encrypted string
to the FormatEncrypt function that would cycle through every character
in the string and replace the ascii characters I have found to be
problematic (#0 - #31,#34,#39,#96,#127 - #159,#180) with a text
representation of that code. Your #0 would be replaced with 'AI0 ' ('
denotes the beginning and ending of a string).The string can then be
saved to the DB.
When it is retrieved from the DB it is passed to the FormatDecrypt
function which cycles through the characters looking for the ascii
code replacement strings and replaces them with the corresponding
ascii character. The 'AI0 ' would be replaced with #0. The string
can now be passed to be decrypted.
Hope this helps!