force encoding to utf-8 before encoding to md5

this avoids encoding errors when urls have unicode chars.