<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Moodle &#8211; Deep Core Labs</title>
	<atom:link href="https://deepcorelabs.com/category/moodle/feed/" rel="self" type="application/rss+xml" />
	<link>https://deepcorelabs.com</link>
	<description>Building Extraordinary Brands</description>
	<lastBuildDate>Tue, 06 Feb 2024 23:56:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://deepcorelabs.com/wp-content/uploads/2015/09/deep-core-labs-logo-small-50x50.png</url>
	<title>Moodle &#8211; Deep Core Labs</title>
	<link>https://deepcorelabs.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Moodle &#8211; Environment error &#8216;It is required that you store all your data in Unicode format&#8217; [SOLVED]</title>
		<link>https://deepcorelabs.com/moodle-environment-error-it-is-required-that-you-store-all-your-data-in-unicode-format-solved/</link>
					<comments>https://deepcorelabs.com/moodle-environment-error-it-is-required-that-you-store-all-your-data-in-unicode-format-solved/#respond</comments>
		
		<dc:creator><![CDATA[Miro Hristov]]></dc:creator>
		<pubDate>Mon, 22 Jan 2024 02:31:37 +0000</pubDate>
				<category><![CDATA[Errors]]></category>
		<category><![CDATA[Moodle]]></category>
		<guid isPermaLink="false">https://deepcorelabs.com/?p=4294</guid>

					<description><![CDATA[The Problem: It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode....]]></description>
										<content:encoded><![CDATA[<h2>The Problem:</h2>
<blockquote><p>It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).</p>
<p>The current setup of MySQL or MariaDB is using &#8216;utf8&#8217;. This character set does not support four byte characters which include some emoji. Trying to use these characters will result in an error when updating a record, and any information being sent to the database will be lost Please consider changing your settings to &#8216;utf8mb4&#8217;. See the documentation for full details.</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939.png" rel="prettyPhoto[gallery-2uX0]"><img fetchpriority="high" decoding="async" class="alignnone size-large wp-image-4295" src="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939-847x1024.png" alt="" width="847" height="1024" srcset="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939-847x1024.png 847w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939-248x300.png 248w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939-768x929.png 768w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194939.png 1031w" sizes="(max-width: 847px) 100vw, 847px" /></a></p>
<h2>The Solution:</h2>
<p>Login to mysql/mariadb via SSH using root user or the user associated with moodle db:</p>
<p><em>(All code snippets below are <strong>editable</strong>)</em></p>
<pre class="EnlighterJSRAW" data-enlighter-language="mariadb">mysql -u moodle_user -p 123456

use moodle;

SHOW LOCAL VARIABLES LIKE 'character_set_database';

--# In my case I got this:

+------------------------+---------+
| Variable_name          |  Value  |
+------------------------+---------+
| character_set_database | utf8mb3 |
+------------------------+---------+
1 row in set (0.001 sec)

--# Run the following to change to utf8mb4

ALTER DATABASE moodle CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

--# Verify again to make sure the change took effect

SHOW LOCAL VARIABLES LIKE 'character_set_database';

+------------------------+---------+
| Variable_name          |  Value  |
+------------------------+---------+
| character_set_database | utf8mb4 |
+------------------------+---------+
1 row in set (0.001 sec)
</pre>
<p>&nbsp;</p>
<p>Make sure in your <strong>./config.php </strong><em>&#8216;dbcollation&#8217;</em> is set to<em> &#8216;utf8mb4_unicode_ci&#8217;</em></p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">//...

$CFG-&gt;dboptions = array (
  'dbpersist' =&gt; 0,
  'dbport' =&gt; '',
  'dbsocket' =&gt; '',
  'dbcollation' =&gt; 'utf8mb4_unicode_ci',  // 'utf8_general_ci' doesn't work
);

//...</pre>
<p>&nbsp;</p>
<div>
<p>If the above doesn&#8217;t work or errors, you may need to add the following to my.cnf and/or mariadb.cnf</p>
</div>
<div>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo nano /etc/mysql/my.cnf

#... append to the bottom

#Moodle required
[ client]
default-character-set = utf8mb4

[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix = true

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake

[mysql]
default-character-set = utf8mb4</pre>
<p>&nbsp;</p>
<p>Restart mariadb:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">systemctl restart mariadb</pre>
<p>&nbsp;</p>
<p>Refresh the page and you should now be able to proceed with the installation:</p>
<p><a href="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916.png" rel="prettyPhoto[gallery-2uX0]"><img decoding="async" class="alignnone size-large wp-image-4297" src="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916-899x1024.png" alt="" width="899" height="1024" srcset="https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916-899x1024.png 899w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916-263x300.png 263w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916-768x875.png 768w, https://deepcorelabs.com/wp-content/uploads/2024/01/Screenshot-2024-01-21-194916.png 1079w" sizes="(max-width: 899px) 100vw, 899px" /></a></p>
</div>
<p>Let me know how it goes or if you have other solutions. Good luck!</p>
<p>&nbsp;</p>
<p>P.S. Also, check my <a href="//deepcorelabs.com/upgrade-mariadb-on-plesk/">article on updating MariaDB since Moodle requires 10.5.6 or greater</a> I think. Ignore the part that is about Plesk if you&#8217;re not using it &#8212; the process is exactly the same except the last step 9. is not necessary on vanilla Ubuntu or CentOS.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://deepcorelabs.com/moodle-environment-error-it-is-required-that-you-store-all-your-data-in-unicode-format-solved/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
