Search blog

Sunday, February 26, 2017

Enabling Multi-byte UTF-8 support in Drupal 7

This tutorial explains the various steps to enable Multi-byte UTF-8 support in Drupal 7. It's a very simple and straightforward process and if implemented rightly, you can easily convert your 'character set' & collation to

According to this post in, multi-byte UTF-8 support for MySQL and other database drivers, allows emojis, Asian symbols, mathematical symbols, etc with your Drupal 7 installation. The only caveat to this is that your Drupal installation must be at least Version 7.50 or higher.

  •  Drupal: Version 7.50 or above
 Initially when you check your Drupal Site Report at: admin/reports/status, you will see a message similar to the image below:

Click on image to enlarge

 The steps below have been compiled from the following post at


1. In order to be able to use this, the following requirements must be met:

In order to allow for large indexes, MySQL must be set up with the following my.cnf settings:


These settings are available as of MySQL 5.5.14, and are defaults in MySQL 5.7.7 and up.

After editing the my.cnf file (often located at /etc/mysql/my.cnf), don't forget to restart the mysql service (for example, with the command sudo service mysql restart) in order to load the new configuration.

2. The PHP MySQL driver must support the utf8mb4 charset (libmysqlclient 5.5.3 and up, as well as mysqlnd 5.0.9 and up).

3. The MySQL server must support the utf8mb4 charset (5.5.3 and up).

Run the command mysql --version to see your current MySQL version.

Steps to enable 


For existing Drupal installations
  • First, back up your database and convert all existing tables to utf8mb4, such as by using the drush command provided by the utf8mb4_convert contrib project.
  • Set the "charset" and "collation" keys on the database connection array in settings.php to "utf8mb4" and "utf8mb4_general_ci" respectively:

     $databases['default']['default'] = array(  
      'driver' => 'mysql',  
      'database' => 'databasename',  
      'username' => 'username',  
      'password' => 'password',  
      'host' => 'localhost',  
      'charset' => 'utf8mb4',  
      'collation' => 'utf8mb4_general_ci',  

 For new Drupal installations

  • Prior to running the installer, edit settings.php and manually add in the full database settings array code, with 'charset' as 'utf8mb4', and 'collation' as 'utf8mb4_general_ci', and with the actual values for 'database', 'username', 'password', 'host', as shown below:

     databases['default']['default'] = array(  
      'driver' => 'mysql',  
      'database' => 'databasename',  
      'username' => 'username',  
      'password' => 'password',  
      'host' => 'localhost',  
      'charset' => 'utf8mb4',  
      'collation' => 'utf8mb4_general_ci',  

  • Then run the installer specifically by accessing install.php, as in (not just

Other database systems

  • PostgreSQL and SQLite support 4-byte UTF-8 out-of-the-box, so no special changes are needed for these.
  • MariaDB and other MySQL equivalents should likely work with similar instructions as above for MySQL.
  • Database drivers provided by contributed modules may or may not support this feature. The best place to look for answers is the issue queue of the contributed module which provides the database driver you are using.
Now when you look at your Drupal Site Report, you should be getting a warning message as the image below, which is related to Database 4 byte UTF-8 support:

Click on image to enlarge 

Converting Characterset & Collation to utf8mb4:

Using SQL commands:

 ALTER DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;  
 ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  

Or if you're still on MySQL 5.5.2 or older which didn't support 4-byte UTF-8, use utf8 instead of utf8mb4:

 ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;  
 ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;  


Easier way using Drush:

Now to convert all your database tables to utf8mb4 characterset and utf8mb4_general_ci collation, you may make use of the following Drush command called UTF8MB4 Convert. Please find detailed instructions of this command here:

The conversion process in your terminal after executing the above commands should be as below:

Click image to enlarge
 Final Message After Conversion:

Click image to enlarge
Finally when all your tables are converted, you can view each of their's Collation by using any database management tool such as phpMyAdmin. 

Click image to enlarge

Finally your Drupal site should display a message like this, confirming successful enabling of  Multi-byte UTF-8 support.

Click image to enlarge
 That's all there is to enable multi-byte UTF-8 support in Drupal 7.

Wednesday, February 22, 2017

Redirect One URL To Another URL Using htaccess in Magento and Other Websites

Below is the technique which you can use to redirect a URL to another URL using htaccess in Magento or various other websites.

 Redirect 302 /en/php/index.php  

Note: A 301 redirect means that the page has permanently moved to a new location. A 302 redirect means that the move is only temporary. Search engines need to figure out whether to keep the old page, or replace it with the one found at the new location. So, if your link has changed permanently then go for 301 redirect else go for a 302 redirect.

For various other redirect techniques you may check the link below:

सिक्नुहोस - मोबाइल फोनलाई FAST बनाउने र MEMORY SPACE बढाउने टेकनिक

Learn how to make your mobile fast and increase your memory space in your Android phones.

Sunday, February 5, 2017

Word Wrapping/Line Wrapping in Geany

If you are looking to line wrap or word wrap your codes in Geany use the following keys combinations:

Press ALT+D +L to toggle Line wrapping or Word wrapping.

Friday, February 3, 2017

Reset Product ID to One (1) in Magento 2x

If you have deleted your sample products and would like to reset the product id to one (1) or any number of your choice, open up your phpMyAdmin or any MySQL client of your choice and enter the following command:

 ALTER TABLE `catalog_product_entity` AUTO_INCREMENT =1  

If you have used table prefix don't forget to append that as well before catalog_product_entity. Example: table-prefix_catalog_product_entity.

Top 5 Posts (Weekly)