← Back to team overview

mahara-contributors team mailing list archive

[Bug 1714868] [NEW] mysql special characters. utf8mb4 collation

 

Public bug reported:

Bug reported in forum post 
https://mahara.org/interaction/forum/topic.php?id=8034&offset=0&limit=10#post32267

MySQL database as we have in Mahara does not support special characters.

In master branch and mysql DB, I added a text block to a page with text 
	"Some characters, like '𝑅' or emoticons '😊', produce the error."

when displaying the page I had this error: 
	[WAR] 72 (blocktype/lib.php:685) unserialize(): Error at offset 18 of 48 bytes
	(complete error log in http://paste.wgtn.cat-it.co.nz/15069e#JTBigIqmZagCFwOVF58qww)

in the DB block_instance table, the data it is trying to unserialize
"a:5:{s:4:"text";s:74:"<p>Some characters, like '"
looks like the it ets cut off on the special character position when is saved in the DB


Moodle has a fix for same problem:

"UTF-8 is a character encoding that most websites use. It encodes each of the 1,112,064 valid code points. To store all of this information, four bytes is required. The most popular values are in the three byte region. MySQL by default only uses a three byte encoding and so values in the four byte range (eg. Asian characters and Emojis) can not be stored. 
MySQL does provide full four byte UTF-8 support, but it requires certain database settings to be configured."

https://docs.moodle.org/31/en/MySQL_full_unicode_support#Steps_to_upgrade
https://github.com/moodle/moodle/blob/master/admin/cli/mysql_collation.php


I tried using this approach by installing Mahara with utf8mb4

create database `mahara-master` character set utf8mb4 collate
utf8mb4_unicode_ci

If we create the database with this char set, we wont be able to install
Mahara, as it only supports utf8. Even if we remove this restriction, we
will have this error:

mysqli error: [1071: Specified key was too long; max key length is 3072
bytes]

could be similar to this bug:
https://bugs.launchpad.net/mahara/+bug/547437

** Affects: mahara
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1714868

Title:
  mysql special characters. utf8mb4 collation

Status in Mahara:
  New

Bug description:
  Bug reported in forum post 
  https://mahara.org/interaction/forum/topic.php?id=8034&offset=0&limit=10#post32267

  MySQL database as we have in Mahara does not support special
  characters.

  In master branch and mysql DB, I added a text block to a page with text 
  	"Some characters, like '𝑅' or emoticons '😊', produce the error."

  when displaying the page I had this error: 
  	[WAR] 72 (blocktype/lib.php:685) unserialize(): Error at offset 18 of 48 bytes
  	(complete error log in http://paste.wgtn.cat-it.co.nz/15069e#JTBigIqmZagCFwOVF58qww)

  in the DB block_instance table, the data it is trying to unserialize
  "a:5:{s:4:"text";s:74:"<p>Some characters, like '"
  looks like the it ets cut off on the special character position when is saved in the DB

  
  Moodle has a fix for same problem:

  "UTF-8 is a character encoding that most websites use. It encodes each of the 1,112,064 valid code points. To store all of this information, four bytes is required. The most popular values are in the three byte region. MySQL by default only uses a three byte encoding and so values in the four byte range (eg. Asian characters and Emojis) can not be stored. 
  MySQL does provide full four byte UTF-8 support, but it requires certain database settings to be configured."

  https://docs.moodle.org/31/en/MySQL_full_unicode_support#Steps_to_upgrade
  https://github.com/moodle/moodle/blob/master/admin/cli/mysql_collation.php


  I tried using this approach by installing Mahara with utf8mb4

  create database `mahara-master` character set utf8mb4 collate
  utf8mb4_unicode_ci

  If we create the database with this char set, we wont be able to
  install Mahara, as it only supports utf8. Even if we remove this
  restriction, we will have this error:

  mysqli error: [1071: Specified key was too long; max key length is
  3072 bytes]

  could be similar to this bug:
  https://bugs.launchpad.net/mahara/+bug/547437

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1714868/+subscriptions


Follow ups