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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -