utf8 column is storing only half of the maximum number of characters
Posted by: Michael Rivard
Date: June 17, 2013 08:11PM


I am using MySQL 5.0.18-max. I have a column of type varchar(4000) and character encoding utf8. The JDBC URL includes useUnicode=true and characterEncoding=UTF-8. I discovered that only the first 2000 characters (i.e. one-half the character limit) are being stored. All of the characters are ASCII (in the row where the problem was discovered), so I'm guessing that MySQL allocated 2 bytes/character when updating or inserting the text but assumed 1 byte/character when looking for the cutoff point.

I don't want to change the character encoding to latin1 because other rows in this column might contain non-ASCII characters (such as left- and right-quotes) that were copied and pasted from MS Word.

I suppose I could simply double the maximum number of characters, but I would like to know what is causing this problem.

This problem is hurting productivity for an entire department within my company, so a prompt reply would be greatly appreciated:)

Michael Rivard

Options: ReplyQuote

Written By
utf8 column is storing only half of the maximum number of characters
June 17, 2013 08:11PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.