MySQL and 0x0B

23 April 2010 12:01

You may or may not know about the wonderful vertical tab character 0x0B. It’s a character that’s not easy to see and can cause issues across a number of different programming languages. In my case a Rails developer was having trouble passing some data from an API. A JSON parser was throwing errors about a specific character. Originally we suspected line breaks were causing the issue but after more digging and examination using Textmate and the Text bundle we spotted the invisible characters and having converted it to hex found out it was 0x0B. A quick Google brings back quite a few results of people having the same problem.

In order to find them in the database I knocked up the following SQL:

SELECT * FROM table WHERE data LIKE CONCAT('%',CHAR(0x0B),'%');

Then to replace them quickly (assuming the 3 records have ID’s 1,2 and 3):

UPDATE table SET data = REPLACE(data,CHAR(0x0B),'') WHERE id IN (1,2,3);

Filed: Technology // Tagged: , ,

You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a comment or leave a trackback from your own site.

One Response to “MySQL and 0x0B”

  1. Ian Winter » Blog Archive » MySQL and 0×0B | mysql on April 23rd, 2010 at 9:05 pm

    [...] Ian Winter » Blog Archive » MySQL and 0×0B april, different-programming, issues-across, languages–, may-not, not-easy, see-and, [...]

Leave a Reply

 
What's ianteresting?   •   Twitter   •   About   •   Contact
©2012 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset