Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

UTF8 db error on question submit

0 votes
209 views
asked Feb 15, 2011 in Q2A Core by Soul_Assassin

A user with possibly a german keyboard writing in english is having the following problem when submitting the question/answer:

 

 

Question2Answer query failed:
 
INSERT INTO qa_words (word) VALUES (_utf8 'o�'),(_utf8 'corresponds'),(_utf8 'soundhit'),(_utf8 'impacts'),(_utf8 'windshields'),(_utf8 'i�m'),(_utf8 'it�s'),(_utf8 'puzzling'),(_utf8 'soundhitglassarmored1'),(_utf8 'cal68w'),(_utf8 'impakt-gummi1'),(_utf8 '001000'),(_utf8 'soundhitglassarmored2'),(_utf8 'impakt-gummi2'),(_utf8 'hitglassarmored')
 
Error 1366: Incorrect string value: '\xE2\xB2' for column 'word' at row 1
 
Im guessing this is due to some weird encryption stuff, but have no idea how to fix. The weird thing is that if you click Back and Cancel, the answer is right there posted with no problem. If you try editing it, the same occurs.

1 Answer

0 votes
answered Feb 16, 2011 by gidgreen
It sounds like your server or the user's browser is overriding the UTF-8 encoding used by Q2A, since E2B2 (hexadecimal) is not valid UTF-8. It could also be that your PHP's mb_strtolower function is returning spurious results. If you post a link to this question the user posted I can take a look.

The reason the question still appeared is that the error occurred during indexing, i.e. to make the question appear in search results.
commented Feb 16, 2011 by Soul_Assassin
The question in question (lol) is located here: http://armastack.info/index.php/564/how-a-specific-model-sounds
commented Feb 16, 2011 by gidgreen
I had a look. I don't think it's the server or browser, but the UTF-8 is definitely getting munged somewhere along the way.

Is it possible you changed any relevant part of the core files?

Apart from that I'm guessing it's an issue with PHP's mb_strtolower(...) function, called in qa-util-string.php. What version of PHP are you using? You can see in the 'Stats' panel of the 'Admin' section.

If it's PHP 5.2.12 (or thereabouts) it could be: http://bugs.php.net/50781
commented Feb 16, 2011 by Soul_Assassin
running php version 5.3.3

It could be something I messed up while integrating the bbcode text markup editor
...