dongyi6183 2017-03-06 15:59
浏览 64
已采纳

MySQL - 编码为charset windows-1251的数据未在服务器上显示

I'm trying to deal with an old server that was resurrected after many years. The problem is that the DB is in a weird state.

The website reads the information from the DB with charset ="windows-1251". The the whole table and the fields in the table seen in phpMyAdmin have collation "cp-1251", which I think is the same as windows=1251. If the text is written in latin everything is displayed properly, but if I write the text in Bulgarian it won't work. Any ideas how to fix the DB issue? I have access to the phpMyAdmin & the admin panel of the website.

I was thinking to switch the charset & collation to utf-8 but I get "?" everywhere. Also I looked up similar websites and I saw that they were using charset = windows-1251 for the same fields, which makes me think that the data in the table is not right.

  • 写回答

1条回答 默认 最新

  • doumizhi0809 2017-03-06 23:41
    关注

    Either use MySQL's CHARACTER SET utf8 or cp1251.

    You will need to switch to that charset throughout

    • the bytes in your client
    • the connection (see set_charaset() in PHP)
    • the column/table (CHARACTER SET ...)
    • html meta.

    For further discussion of the question marks, see Trouble with utf8 characters; what I see is not what I stored

    In particular, the data was lost as you stored it into the table.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题