Fixed an issue with attributes of mixed encoding

Previously records would fail when trying to write a record containing
attributes of mixed encoding, e.g. some attributes with ISO-8859-1
encoding and some with UTF-8 encoding.

This will now work fine in instances where those UTF-8 characters are
encodable to ISO-8859-1.