perl - How to detect malformed UTF characters -
i want detect , replace malformed utf-8 characters blank space using perl script while loading data using sql*loader. how can this?
consider python. allows extend codecs user-defined error handlers, can replace undecodable bytes want.
import codecs codecs.register_error('spacer', lambda ex: (u' ', ex.start + 1)) s = 'spam\xb0\xc0eggs\xd0bacon'.decode('utf8', 'spacer') print s.encode('utf8')
this prints:
spam eggs bacon
Comments
Post a Comment