Use codec.open instead of decoding the string

Looks like some Pythons can't decode `str` type...