Search blog

Sunday, February 26, 2017

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 drupal.org, 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.

Requirements:

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 drupal.org: https://www.drupal.org/node/2754539

For MySQL

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:

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:

Then run the installer specifically by accessing install.php, as in http://example.com/install.php (not just http://example.com/)

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:

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: https://www.drupal.org/project/utf8mb4_convert.

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.

Wednesday, February 22, 2017

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 http://www.example.com/newpage.html

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.

Friday, February 3, 2017

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.

Email Subscription:

Support/Donate:

Drupal Association Member

eV@gabond - The Meaning

" I want to be an educated vagabond, not a vagabond out of weakness. I don't want to do anything in my life out of weakness - because I could not be anything else, that's why I am a Vagabond - that is not my way. First I want to prove to the world that I can be anything that I want to be, but still I choose to be a vagabond - out of strength. Then there is respectability even if you are a Vagabond, because respectability has nothing to do with your vocation, your profession; respectability has something to do with acting our of strength, clarity, intelligence. "