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.

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料