Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When saving a field, during the "Rebuilding Views Natural Sort Indexing Entries", I got the following exception on nodes with long unicode titles:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'content' at row 1: INSERT INTO {views_natural_sort} (eid, entity_type, field, delta, content) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 14588 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => title [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => <A_VERY_LONG_TITLE_WITH_UNICODE_CHARACTERS> ) in views_natural_sort_store() (line 232 of <PATH_TO_MODULES>/views_natural_sort/views_natural_sort.module).
Comment | File | Size | Author |
---|---|---|---|
#2 | views_natural_sort-fix_unicode_substring-2916478-1.patch | 494 bytes | karivolas |
Comments
Comment #2
karivolas CreditAttribution: karivolas commentedThis was happening because the php substr() function was used, instead of mb_substr() which supports unicode characters.
Comment #5
generalredneckGot this pushed to the latest development release and wrote a test for your fix.
Comment #7
generalredneckReopening as it needs to be applied to D8
Comment #9
generalredneckOk ported the changes made in Karivolas' patch above to the 8.x-2.x branch... along with tests.