Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Проблема с кодировкой при переходи с MySQL 4.0 на 4.1.* &  (Read 4553 times)

0 Members and 1 Guest are viewing this topic.

Makc666

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1614
  • Русский (ISO-8859-1) - Russian - Русский (Windows)
    • Makc's home page

Решил написать на основе темы:
encoding issue (MySQL 4.1.15)
http://forum.coppermine-gallery.net/index.php?topic=24129.0
, т.к. сам столкнулся с этим.

Если Вы или Ваш хост обновились с MySQL 4.0 на 4.1.* или 5.*
Если MySQL 4.1.* или 5.* работает по умолчанию в UTF-8. -->> MySQL-кодировка: UTF-8 Unicode (utf8)
Если база данных вашей галереи в кодировке cp1251. -->> Сравнение "cp1251_general_ci"
 
То нужно...

Открыть файл:
include/functions.inc.php

Найти кусок кода:
Code: [Select]
function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result) {
                return false;
        }
        if (!mysql_select_db($CONFIG['dbname']))
                return false;
        return $result;
}

Добавить в него строку:
Code: [Select]
mysql_query("SET NAMES 'cp1251'",$result);
Чтобы получилось вот так:
Code: [Select]
function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result) {
                return false;
        }
        if (!mysql_select_db($CONFIG['dbname']))
                return false;
mysql_query("SET NAMES 'cp1251'",$result); <<--- добавленная строка
        return $result;
}

Сохранить файл.

Вот и всё :)
« Last Edit: July 30, 2009, 02:16:45 pm by Makc666 »
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.