Some links are received as unicodes and some others not which causes problems. Use repr and decode(unicode-escape) and then re-encode to latin-1