HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Error when posting a comment with a smiley face

denndenn New
edited August 2020 in Vanilla 3.x Help

Hi! I have a problem when posting a comment with a smiley face. Error writing to the database

Incorrect string value: '\xF0\x9F\x99\x84"}...' for column `forum`.`GDN_Comment`.`Body` at row 1|Gdn_Database|Query|insert `GDN_Comment` (`Body`, `DiscussionID`, `InsertUserID`, `Format`, `DateInserted`, `InsertIPAddress`) values (:Body, :DiscussionID, :InsertUserID, :Format, :DateInserted, :InsertIPAddress)

vanilla version: 3.3

charset GDN_Comment utf8mb4_unicode_ci

mariadb 10.4.10

Help me solve the problem. Thank You 😊

Comments

  • denndenn New
    edited August 2020
    MariaDB [forum]> SHOW CREATE DATABASE `forum`;                                                                                             
    +-----------+--------------------------------------------------------------------------------------------------+                                   
    | Database  | Create Database                                                                                  |                                   
    +-----------+--------------------------------------------------------------------------------------------------+                                   
    | forum | CREATE DATABASE `forum` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ |                                   
    +-----------+--------------------------------------------------------------------------------------------------+                                   
    
    MariaDB [forum]> show variables WHERE Variable_name LIKE 'character\_set\_%'  OR Variable_name LIKE 'collation%';                              
    +--------------------------+--------------------+                                                                                                  
    | Variable_name            | Value              |                                                                                                  
    +--------------------------+--------------------+                                                                                                  
    | character_set_client     | utf8               |                                                                                                  
    | character_set_connection | utf8               |                                                                                                  
    | character_set_database   | utf8mb4            |                                                                                                  
    | character_set_filesystem | binary             |                                                                                                  
    | character_set_results    | utf8               |                                                                                                  
    | character_set_server     | utf8               |                                                                                                  
    | character_set_system     | utf8               |                                                                                                  
    | collation_connection     | utf8_general_ci    |                                                                                                  
    | collation_database       | utf8mb4_unicode_ci |                                                                                                  
    | collation_server         | utf8_general_ci    |                                                                                                  
    +--------------------------+--------------------+                                                                                                        
    
                                                                              
    the forum was moved to a new domain. Export / import of the database was done via phpmyadmin. All settings were set by default.
    


  • denndenn New
    edited August 2020

    I found a solution. Maybe someone will need it.

    [mysqld]

    collation-server=utf8mb4_unicode_ci

    init-connect='SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'

    character-set-server=utf8mb4

    [client]

    default-character-set=utf8mb4

    [mysql]

    default-character-set=utf8mb4

Sign In or Register to comment.