douci1918 2015-12-17 18:15
浏览 39

备份和还原后的blob文本

Updated Question :

I had one old script with mysql 5.5.46 . i was storing my text in one columnt with blob type. my text was persian like this : سلام خوبی جه خبر . after some month's i changed blob column to longblob column with phpmyadmin with gui(without any converting query). everything work's correctly but i get backup from my mysql and restored this db after 2 years. now it's not show my persian characters correctly.english text is ok but persian text's is going someting like the hex i mentioned in my question. I need text's stored in page_about and page_contact columns in this table: Creating Table :

    mysql_query("CREATE TABLE `".$prefix."ProFolio_info` (
                      `id` int(5) NOT NULL auto_increment,
                      `page_about` blob NOT NULL,
                      `page_contact` blob NOT NULL,
                      PRIMARY KEY  (`id`)
                    ) TYPE=MyISAM AUTO_INCREMENT=1") or die(mysql_error());

Updating Data :

$info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,10");

   while($info_row = mysql_fetch_array($info_query)){
        $about_page = html_entity_decode($info_row['page_about']);
        $contact_page = html_entity_decode($info_row['page_contact']);

    if(isset($_POST['change_settings']) && $LOGGEDIN == 'yes'){

    $new_aboutpage = clean_page($_POST['about_page']);
    $new_contactpage = clean_page($_POST['contact_page']);


    if($about_page != $new_aboutpage){
        mysql_query("UPDATE ".$prefix."ProFolio_info SET page_about = '$new_aboutpage' WHERE id = '$info_id'");
    }
    if($contact_page != $new_contactpage){
        mysql_query("UPDATE ".$prefix."ProFolio_info SET page_contact = '$new_contactpage' WHERE id = '$info_id'");
    }

get texts from DB :

 <textarea name="contact_page"><? echo str_replace('<br />', '', $contact_page); ?></textarea> 
 </div>

i tested some query like cast and convert and convert column to longtest but result is the same and i have wrong chracters.

I think it stored with latin1 collation but I select column with utf-8

HEX

BC28620264F736C6173683B26756D6C3B264F736C6173683B26736563743B265567726176653BC284264F736C6173683B26736563743B20265561637574653B266D6163723B265567726176653BC281264F736C6173683B266F7264663B265567726176653BC28520264F736C6173683B26736563743B2655636972633BC28C265567726176653BC286264F736C6173683B266E6F743B264F736C6173683B26736563743B20265567726176653BC286265567726176653BC2852655636972633BC28C265561637574653B266D6163723B265567726176653BC286264F736C6173683B266E6F743B265567726176653BC28720264F736C6173683B26736563743B265567726176653BC285264F736C6173683B26736563743B20265567726176653BC285264F736C6173683B26737570333B265567726176653BC286265561637574653B26636F70793B265567726176653BC28720265561637574653B266D6163723B265567726176653B

i uploaded my script in github also uploaded script in my server and sending text from script but data going to db correctly ! i think it's just because of my backup of database. you can check my ready script from here and view my text's from kave note's menu;

  • 写回答

2条回答 默认 最新

  • dongpa5207 2015-12-18 06:14
    关注

    I have too got the same problem the main reason is windows uses different kind of character encoding for different characterset. I have found the package convert character set. It has solved my problem and it may solve your too.

    评论

报告相同问题?

悬赏问题

  • ¥15 求帮我调试一下freefem代码
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图