Is there an easy way to avoid dealing with text encoding problems?
You can use Cactoos (no static methods, only objects):
You can convert the other way around too: