Handle unicode nastiness when encoding params

Fix for issue #42 that I recently raised. Assumes utf-8 as the default encoding, but that should be a good default for modern sites.