Event Calendar lost first symbol from title in Russian language

I am using Elgg 2.3.10 and Event Calendar plugin 2.3.2, but if I'tried to enter the Title in Cyrillic language the first symbol looks damaged. But not any Cyrillic symbol I've found only one which cause the error.



  • Works for me w/o any errors.

    Seems, this is an another 3-rd party plugin's issue. Try to disable all 3-rd party activated plugins; leave event calendar only and try again.

    Another trick: I had such a problem too (с буквой Р). In my own custom plugin not Event Calendar. After switching MySQL to utf8mb4, everything worked again.

  • I've no experience with Cyrillic character encoding. But I would think that UTF8 encoding should be sufficient (maybe I'm wrong and UTF8MB4 is necessary for some characters). The example RvR has included in his posting works for me fine with UTF8 used for the database tables (though I'm not sure I implicitely get UTF8 encoding anyway when copy+paste с буквой Р for testing). For the input correctly saved the database tabled involved would have to use UTF8 encoding at least. But maybe the problem is not the input but rather the output. What's the encoding you have selected in your browser for output of websites? If you enforce some encoding it might help to change this to an "automatic" selection as websites (including Elgg) tells the browser the encoding to be used.

  • Thank you @RvR and @iionly for your support!

    The problem is not only in the Calendar Event Plugin but in other components too.

    Now I've use the new database with the utf8 charset in it and receive the same error as in the previous db with the cp1251 encoding, no additional plugins after clean install.

    The character brokes in the Group Title and User Name also.

    Possibly the source of the error such in the this old thread https://elgg.org/discussion/view/236843/national-characters-corrupted-in-db-not-utf8

  • The old thread you've linked refers to version 1.6 of Elgg. As far as I now, the DB encoding wasn't UTF8 by default back then. With a new installation of a recent version of Elgg (e.g. 2.3.x) this should no longer be a problem as the DB tables get created with UTF8 encoding.

    The problem in your case might be the encoding used by the browser. If it's not UTF8 (e.g. forced to some other encoding) there might be already a problem with the input getting saved correctly. For example the title input and also other inputs get filtered by Elgg to prevent malicious data/code getting saved in the database and displayed later on. The output of the filtered and then saved data is UTF8. But if the input was in some other encoding the conversion to UTF8 might already result in wrong characters getting saved. Or later on the browser tries to display the output (which might still be fully correct) in some other encoding and then fails to do so correctly with some characters. I would suggest to check the settings of your browser to see if there might be some encoding selected other than UTF8. Maybe changing this setting makes a difference.

  • Thanks a lot for your support! Unfortunately I'am stuck this that :-).

    I've created the DB from scratch using UTF8mb4 everywhere. Reinstalled the Elgg. But the problem persist only at my hosting. Not at local pc. In any browser. Also I've checked different code pages in Browser settings.

    And the problem only with one character 'И'. If I used 'И' anyplace at Elgg then received the two questions ?? in place. This is saved in database also as ?? and only in the place that correspond to 'И'. Placing two 'И' at any word - leads to elgg.js errors and such words did not saved.

    This is a sample of testing of Russian alphabet in both cases - https://www.awesomescreenshot.com/image/3829716/0fd60eace5e904aafb84e99b32693d9a



  • As I said in the previous reply: switching MySQL to utf8mb4 solved the same issue with russian symbols for me.

    During this error (e.g., typing красава) I got this PHP error:

    'DatabaseException' with message 'An exception occurred while executing 'INSERT INTO elgg_metastrings (string) VALUES (?)' with params ["\xd0\xba\xd1"]:
    SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'string' at row 1
    QUERY: INSERT INTO elgg_metastrings (string) VALUES (:string)
    PARAMS: Array
        [:string] => РєС
    ' in /vendor/elgg/elgg/engine/classes/Elgg/Database.php:446
    Stack trace:
    #0 /vendor/elgg/elgg/engine/classes/Elgg/Database.php(252): Elgg\Database->executeQuery('INSERT INTO elg...', Object(Doctrine\DBAL\Connection), Array)
    #1 /vendor/elgg/elgg/engine/classes/Elgg/Database/MetastringsTable.php(181): Elgg\Database->insertData('INSERT INTO elg...', Array)
    #2 /vendor/elgg/elgg/engine/classes/Elgg/Database/MetastringsTable.php(133): Elgg\Database\MetastringsTable->add('\xD0\xBA\xD1')

    So, in first, check your error log.

    If your error log similar on my log then your solution is utf8mb4.

    Check your configurations:

    1 - Database: Change Database default collation as utf8mb4:

    default-character-set = utf8mb4
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci
    default-character-set = utf8mb4

    2 - Tables: Change table collation as CHARACTER SET utf8mb4 COLLATE utf8mb4_bin.

    Especially for these tables:

    elgg_scraper_data //if it exist

    3 - Set utf8mb4 in database connection:

    $database_connection = new mysqli($server, $user, $password, $database_name);

    Finally, Google can help more.

    Reference: https://mathiasbynens.be/notes/mysql-utf8mb4

  • @RvR,

    Please, let me know the better way to set utf8mb4 in database connection in Elgg? 

  • All in my reply above:

    • Change my.cnf
    • Change tables - use phpMyAdmin (if not comfortable with CLI)
    • Restart MySQL server

    Read the mentioned article - https://mathiasbynens.be/notes/mysql-utf8mb4

  • You might want to get in contact with the support of your webhoster asking them if your database server is correctly configured to be fully capable of handling utf8 characters. Not sure what could be the problem but they might be able to tell you if there's anything preventing correct handling of utf8 even if the tables itself (created by Elgg) use utf8 encoding.

    If it's not the DB server config - and surely it's not Elgg as seems to work for others without issues - I come back to the possibility that it's some setting in your browser or possible also some setting in your Operating System that causes the issue if there some other encoding used on your computer. Have you tested it on another computer (or smartphone) or asked other users if they have the same problem?

  • @just4fun I'm not sure that reason is an encoding, anyway, check out this parameter in your php.ini:

    default_charset = "UTF-8"
Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.