汉字问题 [英] problem with chinese character

查看:86
本文介绍了汉字问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用这个将汉字存储到mysql表中

We can store Chinese character into mysql table Using this

("元http-equiv =" Content-type"value =" text/html; charset = UTF-8"")

在页面顶部,轻松地通过输入框手动输入汉字,它可以正常工作并将汉字存储到mysql表中,如下所示(" A #20026; A #24744; A #20026; A #24744;).
但是,当使用php从excel文件中读取中文字符并希望使用php插入mysqltable时,它将像这样存储

at the top of the page and taking Chinese character through input box manually easily, it works OK and store Chinese character into mysql table like this("A#20026;A#24744; A#20026;A#24744;").
But when read Chinese char from an excel file using php and want to insert in mysqltable with php then it stores like this

(" 上海东渡船舶管ç†æœ‰é™å…¬å¸)

("上海东渡船舶管ç†æœ‰é™å…¬å¸")

在没有HTTP标头的情况下,借助php标头功能["header('Content-type:text/html; charset = UTF-8');"]也可以正常工作. 但是我想像上面那样存储中文字符(" A #20026; A #24744; A #20026; A #24744;)在mysql表中.

This is also working fine with the help of php header function ["header('Content-type: text/html; charset=UTF-8') ;"] without http header it is no working. But I want to store chinese char like above("A#20026;A#24744; A#20026;A#24744;") in mysql table.

注意:=您在代码中看到"A" 的地方有"和号"符号.如果我在此处写"和号",它将显示为汉字,因此请注意.

Note:= Where u see "A" in code there is "ampersand" sign. If i write "ampersand" there then it will display as chinese character, so here noticed.

任何人都可以帮助我吗? 帮助应该很愉快. 谢谢.祝你有美好的一天...

Any one can help me ? Help should be happily. Thanks. Have a nice day...

推荐答案

您应该将问题从SQL重新标记为Excel.显然,它与mysql没有关系.问题是您在PHP中读取Excel文件的部分.您从Excel文件中获取了损坏的数据,然后采取任何措施为时已晚.

You should retag your question from SQL to Excel. Apparently, it is not related to mysql. Problem is the part where you read Excel file in PHP. You get corrupted data from Excel file and then it is too late to do anything.

您用来读取Excel文件的库完全了解Unicode字符吗? PHP是否了解unicode或该库至少能够在utf-8中发送unicode字符?我不这么认为. (UTF-8字符串可以在实际上不支持unicode的脚本环境中正常工作,因为该程序仅将字符串从用户传输到数据库,反之亦然.)

Does library you use to read Excel files understand unicode characters at all? Do PHP understand unicode or is that library at least able to send unicode characters in utf-8? I don't think so. (UTF-8 strings can work correctly in scripting environments where unicode isn't actually supported, because the program only transfers the string from user to database and vice versa.)

这篇关于汉字问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆