Prevent UnicodeEncodeError: 'ascii' codec can't encode characters in position ...: ordinal not in range(128)
Encode to utf-8 only when needed
Merge pull request #4221 from ashorin/unicode-md5

Prevent UnicodeEncodeError: 'ascii' codec can't encode characters in pos...