wallabag: 500 HTTP error adding a new article

Issue details

  1. Add => http://lamiradadelreplicante.com/2017/03/12/15-anos-de-arch-linux/
  2. Error happens;

500: Internal Server Error

An exception occurred while executing 'INSERT INTO `wallabag_entry` (uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, http_status, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [null, "15 a\u00f1os de Arch Linux", "http:\/\/lamiradadelreplicante.com\/2017\/03\/12\/15-anos-de-arch-linux\/", 0, 0, "<section cl

...

o.jpg", null, 200, 1]: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\x89</...' for column 'content' at row 1

Environment

  • Wallabag 2.2.2
  • Mysql 5.7.17
  • PHP: 7.0.15
  • wallabag_entry table encoding => utf8mb4_unicode_ci (not changed)

Update: I recently upgrade from 2.2.1 without problems. This is happening only in this article.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

I changed the mysql server configuration adding this:

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

Now the previous sql query retuns:

character_set_client	utf8mb4	
character_set_connection	utf8mb4	
character_set_database	utf8mb4	
character_set_filesystem	binary	
character_set_results	utf8mb4	
character_set_server	utf8mb4	
character_set_system	utf8	
collation_connection	utf8mb4_unicode_ci	
collation_database	utf8mb4_unicode_ci	
collation_server	utf8mb4_unicode_ci	

Now I can add the article correctly, but since this is not the default mysql server configuration I think you should add this in wallabag. This is the configuration used by mysql if you don’t add the encoding when you stablish the connection in PHP.

More info => https://mathiasbynens.be/notes/mysql-utf8mb4

For people like me who keep finding this thread because they get General error: 1366 when trying to add certain articles to a docker wallabag using mysql: firstly, make sure your mysql wallabag schema is set so that character_set_database = utf8mb4 as above; and add SYMFONY__ENV__DATABASE_CHARSET=utf8mb4 to your wallabag docker environment so that ansible builds the correct value in parameters.yml. This isn’t documented and took ages to find.