Views: 886
Last Modified: 20.04.2021

The following errors can be encountered when updating old sites that have Windows-1251 encoding, created in VMBitrix version 7.4.3 or lower:

  • Bitrix24 product update system is not operating correctly – requires the available parameter mb_internal_encoding('Windows-1251'); в dbconn.php.

  • With enabled Update system notifications does not operate due to the warning: «PHP Warning: htmlspecialchars(): charset `latin' not supported, assuming utf-8».

  • System check issues an error: "String functions strtoupper and strtolower operate incorrectly".

When updating VMBitrix to version 7.5 and higher, these errors occurring in previously installed sites with Windows-1251 encoding are not fixed automatically. That is why, you need to fix them manually for each individual site.

  1. Add the following string to the file /bitrix/php_interface/dbconn.php:

  2. Replace the following string in the Apache config file for your site /etc/httpd/bx/conf/bx_ext_[your_site].conf:

    php_admin_value default_charset latin
    with this string:
    php_admin_value default_charset cp1251

    and relaunch the Apache:

    systemctl restart httpd.service
  3. Check, if the locale en_EN.cp1251 is available in the system. When response is 0, it means that the localeen_EN.cp1251 is not available, when 1 – it is available:

    locale -a | grep en_EN.cp1251 -ic

    When locale en_EN.cp1251 is not available, execute the following command:

    localedef -c -i en_EN -f CP1251 en_EN.CP1251
  4. Then add two strings into your site's file /bitrix/php_interface/dbconn.php that has windows-1251 encoding:

    setlocale(LC_ALL, 'ru_RU.CP1251' );
    setlocale(LC_NUMERIC, 'C' );

    and relaunch Apache:

    systemctl restart httpd.service
  5. All is ready. Perform these actions for each individual site with encoding windows-1251, created previously.

Note: VMBitrix 7.5 and higher, new sites, created with Windows-1251 encoding won't have any issues with single-byte character encodings.

Courses developed by Bitrix24