Use encode instead of force_encode where possible.
When checking for formats, ensure that everything is encoded as UTF-8.
Make sure inline strings are all encoded as UTF-8.