Apr-09-2020, 05:35 PM
I have a function in a Python script that serves to remove non-ASCII characters from strings before these strings are ultimately saved to an Oracle database.
Any suggestions on how to modify the above Python string to do what needs to be done?
Thanks!
# This should remove any ASCII characters between 0-31 and also ones 127 & up. sCleanedString = re.sub(r'[^\x20-\x7E]',r'', sStringToClean)When I pass in a large string that's the full and complete content of an entire email message to clean, it's stripping out the line break characters and leaving me with a cleaned string that's all jumbled up with no line breaks. For this special case, I'd like to clean the string but leave the line break characters.
Any suggestions on how to modify the above Python string to do what needs to be done?
Thanks!