I'm trying to test some application level ruby methods and how they handle invalid utf-8. I'm trying something like to get invalid utf-8:

mysql> update items set header=UNHEX('4D2AFF') where id=10938;
ERROR 1366 (HY000): Incorrect string value: '\xFF' for column 'header' at row 1

Is there a way to update a varchar(255) to invalid utf-8?


Why not changing the text strings to a binary encoding or non-utf8 encoding, or to use binary strings (varbinary, blobs)? That will allow you to store all invalid values that you want.

Edit: To be more specific: change the type to varchar(255) charset binary, that may cause you all kind of charset problems .

@RLF, funny that you mention Wikipedia, text on the wikipedia is stored in binary format!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.