0

From time time to time my PostgreSQL DB is reporting a strange error:


[client] postgres7 error: [-1: ERROR: invalid byte sequence for encoding \"UTF8\": 0xb4 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by \"client_encoding\".] in adodb_throw(INSERT INTO page_comments(pageid, pagetype, sender_name, sender_mail, sender_url, comment, owner_uid, owner_gid, sortorder, level, parent) VALUES( 1493, 102, \'alexis\', \'[email protected]\', \'\', \'

Next friday i´ll visit Barcelona so in case you need one of this mugs please let me know.

\', 1000, 1000, 1, 1, NULL ), )


Now, I see that it is coming from the funny apostrophe sign. Yet I am totally confused, as the DB was initialized in UTF8, the web application is serving UTF8 pages, and, moreover, the content is being even utf8_encoded before it is pushed into the database.

Does anybody know how to avoid this error?

1 Answer 1

2

U+00B4, ACUTE ACCENT, is encoded as '\xb4' in ISO-8859-1. In UTF-8, it would be '\xc2\xb4'. So some part of your application changes the encoding to Latin-1. Find and fix that place, and the error should go away.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks! I just figured out that ajax requests were not encoded properly by javascript, thus some symbols got screwed up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.