I'm trying to rewrite an old website .
it's in persian which uses perso/arabic characters .
CREATE DATABASE `db` DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci;
USE `db`;
Almost all my table/columns COLLATE are set to utf8_persian_ci
I'm using codeigniter for my new script and i have
'char_set' => 'utf8',
'dbcollat' => 'utf8_persian_ci',
In the database settings , so there is no problem there .
So here is the strange part
The old script is using some sort of database engine called TUBADBENGINE
or TUBA DB ENGINE
... nothing special .
When i enter some data in the database (in persian) using the old script , when i look into database , characters are stored like ?1ù…?±?§ù?
.
The old script fetch/shows that data fine , but the new script shows them with the same weird font/charset as database
So when i enter ????
, database stored data looks like ?1ù…?±?§ù
, when i fetch it in the new script i see ?1ù…?±?§ù
but in the old script i see ????
CREATE TABLE IF NOT EXISTS `tnewsgroups` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`fName` varchar(200) COLLATE utf8_persian_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=11 ;
--
-- Dumping data for table `tnewsgroups`
--
INSERT INTO `tnewsgroups` (`ID`, `fName`) VALUES
(1, '?1ù…?±?§ù?'),
(2, 'ù…?1ù…?§?±??'),
(3, '?¨?±ù?'),
(4, 'ù…ú??§ù???ú?'),
(5, 'test'),
(6, 'test2');
In the other hand when i enter ?????
directly in the database
Of course i have the same ????
stored in the database
The new script is showing it fine
But in the old script i get ????
Can anyone make any sense of this ?
Here is the tuba engin
https://github.com/maxxxir/mz-codeigniter-crud/blob/master/tuba.php
Usage example from old script :
define("database_type" , "MYSQL");
define("database_ip" , "localhost");
define("database_un" , "root");
define("database_pw" , "");
define("database_name" , "nezam2");
define("database_connectionstring" , "");
$db = new TUBADBENGINE(database_type , database_ip , database_un , database_pw , database_name , database_connectionstring);
$db->Select("SELECT * FROM tnews limit 3");
if ($db->Lasterror() != "") { echo "<B><Font color=red>??? ! á?Y? ?ì???? êá?? ??í?"; exit(); }
for ($i = 0 ; $i < $db->Count() ; $i++) {
$row = $db->Next();
var_dump($row);
}
Question&Answers:
os