View Single Post
Author Message
damage220
Member
Join Date: Jul 2022
Location: Ukraine
Old 11-30-2023 , 13:30   ??? instead of Cyrillic letters on debian after SQL_SetCharset
Reply With Quote #1

Hello. I have following table
PHP Code:
  CREATE TABLE `users` (
    `
idint(11NOT NULL AUTO_INCREMENT,
    `
namevarchar(255NOT NULL,
    
PRIMARY KEY (`id`),
  ) 
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
After creating db tuple, I call SQL_SetCharset with value "utf8mb4".
PHP Code:
_dbh SQL_MakeDbTuple(hostuserpassdb);
is_success SQL_SetCharset(_dbh"utf8mb4");
server_print("[%f] [SQL_SetCharset] is_success: %d"get_gametime(),
    
is_success); 
It works perfect on my local machine but remote one - all Cyrillic letters are replaced with question marks. Does anyone know why?

Local machine
Linux distro: Arch Linux
Database: mariadb from 11.1.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1

Remote machine
Linux distro: Debian 11
Database: mariadb Ver 15.1 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

A few more words about the issue. For example, I have nickname "Привет".
PHP Code:
                         Local machine Remote machine
  without SQL_SetCharset 
Привет  | Привет
  
with SQL_SetCharset    | Привет  | ??????
  
SQL_SetCharset returns 1             
It seems that code parser replaces first Cyrillic letter with html code.

Well, I can remove SQL_SetCharset and then it would work on remote machine, but my test environment becomes broken. Also I want to know the reason why encoding on debian is forced without SQL_SetCharset call?

Last edited by damage220; 12-03-2023 at 13:06.
damage220 is offline