How can I fix encoding errors in a string in python -
i have python script subversion pre-commit hook, , encounter problems utf-8 encoded text in submit messages. example, if input character "å" output "?\195?\165". easiest way replace character parts corresponding byte values? regexp doesn't work need processing on each element , merge them together.
code sample:
infocmd = ["/usr/bin/svnlook", "info", sys.argv[1], "-t", sys.argv[2]] info = subprocess.popen(infocmd, stdout=subprocess.pipe).communicate()[0] info = info.replace("?\\195?\\166", "æ")
i same things in code , should able use:
... u_changed_path = unicode(changed_path, 'utf-8') ...
when using approach above, i've run issues characters line feeds , such. if post code, help.
Comments
Post a Comment