Handle encoding mismatches on data attribute

The encoders return strings in UTF-8 encoding while the database
may return strings in BINARY. Make sure we're coercing the string to
the same encoding as the existing value so dirty attribute detection
isn't thwarted.