Improve UTF-8 support

@boucher Any opinions on this?

This will notably cause a slight backwards incompatibility if people were previously creating resources by passing UTF-8-encoded IDs. Previously they would get double-encoded both when they were created and when they were retrieved; now they will only be single-encoded, so we may see some new 404s.

I've checked the DB for user-provided IDs which aren't pure-ASCII && are still valid UTF-8 after going through an UTF-8->ISO-8859-1 transcoding (I think that's the correct check). I didn't find any, so I don't think the incompatibility matters in practice.