In python I use an html template to display a steam player's information.
The template is:
'''<td>
<div>
Name: %s<br>
Hours: %s<br>
<a href="http://steamcommunity.com/profiles/%s" target="_blank">Steam Profile</a> <br>
</div>
</td>'''
So I have TEMPLATE %(personaName, tf2Hours, id64)
Later on that template is saved into an html file.
Occasionally it returns a UnicodeDecodeError, because personaName can contain strange characters.
Is there a way to avoid this while still having the correct characters in the final html file?
EDIT:
The reason for the error was non-unicode characters.
Doing unicode(personaName, errors='ignore') solved the issue.