encoding cleanup for html renderings

http://manage.dimagi.com/default.asp?99048

also should fix the wacky unicode renderings in html previews