Views: 11024
Last Modified: 04.05.2022

A website developer always faces the problem: which encoding to choose for the project.

UTF-8 is considered promising. However, everything has its drawbacks. And the decision to use any encoding only because it is promising, without taking into account many other factors is not correct. The choice will be good only when it completely takes into account all aspects of a specific project. That it is not easy to foresee all of the aspects is another matter.

We think that the use of UTF-8 is preferable, but it is up to a project developer to decide what to choose.

How to Switch a Website from the National Encoding to UTF-8

General procedure:

    1. Re-encode all databases in UTF-8 (you will most likely have to seek assistance from the server administrator).

    2. Re-encode all of the website files into UTF-8 (you can do it yourself).

    3. Add the following lines in the file /bitrix/php_interface/dbconn.php:

    define("BX_UTF", true); 

    4. Add the following lines in the file /.htaccess:

    php_value mbstring.func_overload 2 
    php_value mbstring.internal_encoding UTF-8 

It is possible to re-encode all website files to UTF-8 (second option) through SSH using the command convmv. For example, convert ISO8859-1 (legacy Western European) filenames to UTF-8:

convmv -f iso-8859-1 -t utf8 -r --notest ./

Courses developed by Bitrix24