'exception While Reading Request', 'detail': 'cannot Decode: Java.io.stringreader@1aac9ea'}, 'status': 'failure'}
My first question is, what does 'cannot decode: java.io.stringreader' mean? My second question is, why do some strings work and others do not? I'm guessing that there's an issue wi
Solution 1:
This ended up being an issue with the encoding in the source xml records. Python couldn't translate a ton of weird junk characters. I created a way to strip out the odd characters. Here's the code I used...
def fix_multi_line_string(text):
'''Given a string input,
replace all unwanted characters with desginated replacements.
Return the fixed string.'''
char_map = {
'•': '-',
'\t': '',
'\n': '',
'\r': '',
'\u200b': '',
'"': "'",
'\ufffd': '',
'\uf0b7': '',
'\uf0a7': '',
'\uf071': '',
'\u25e6': '',
'\uf020': '',
'\u2265': '',
'\u200e': '',
'\uf0d8': '',
'\u2010': '',
'\uf04a': '',
'\u25fe': '',
'\u2610': '',
'\u2015': '',
'\u2612': '',
'\uf04c': '',
'\uf15c': '',
'\ue1ef': '',
'\u25b2': '',
'\U0001f609': '',
'\u2502': '',
'\uf02a': '',
'\uf0e0': '',
'\uf028': '',
'\u25a1': '',
'\ue0e8': '',
'\u2003': '',
'\uf0a0': '',
'\ue900': '',
'\ue901': '',
'\ue076': '',
'\ue1d9': '',
'\ue1ed': '',
'\u25bc': '',
'\uf073': '',
'\ue099': '',
'\uf0fc': '',
'\uf0df': '',
'\uff08': '',
'\u2002': '',
'\uf0e8': '',
'\uf07f': '',
'\uf06f': '',
'\u263a': '',
'\ue1b4': '',
'\ue1b4': '',
'\u2500': '',
'\uf084': '',
'\ue0ca': '',
'\U00100078': '',
'\uf027': '',
'\uf0ac': '',
'\U0001f604': '',
'\uff1f': '',
'\uff0c': '',
'\uff01': '',
'\u2219': '',
'\u2219': '',
'\U0001f60a': '',
'\uf0a8': '',
'\ue172': '',
'\ue080': '',
'\ue113': '',
'\ue1bc': '',
'\ue202': '',
'\u2190': '',
'\u2192': '',
'\uf076': '',
'\ue021': '',
'\uf06e': '',
'\uf030': '',
'\uf077': '',
'\uf111': '',
'\uf12a': '',
'\ue22a': '',
'\u2981': '',
'\uf02d': '',
'\uf037': '',
'///': ''
}
for char in char_map:
text = text.replace(char, char_map[char])
return text
Post a Comment for "'exception While Reading Request', 'detail': 'cannot Decode: Java.io.stringreader@1aac9ea'}, 'status': 'failure'}"