UTF-8 encode Unicode characters in strings and literals.

This fixes non-ASCII search queries in browserbox. Perhaps this breaks the abstraction and should be dealt with in browserbox but you can be the judge of that. If that's the case then there should at least be some assertion code in imap-handler that checks for valid input.