Properly handle both utf8 and binary data.