我有一个用拉丁语和瑞典语存储文本的数据库。 如果我用php(用utf-8编码)从这个数据库中检索到数据,我就得到了正确的结果
结果如下:
measured at Dungsha coraisland (20°42’N, 116°43’E) during the South China Sea Monsoon Experiment (May-June 1998) have been calibrated and compared with radiative transfer calculations for three clear-sky days.
但是,当我使用python和mysql connector时,我得到了错误的结果!在
结果如下:
Downward total solar fluxes measured at Dungsha coraisland (20¢X42¡¦N, 116¢X43¡¦E) during the South China Sea Monsoon Experiment (May-June 1998) have been calibrated and compared with radiative transfer calculations for three clear-sky days.
目前,我的部分代码如下所示:
cnx = mysql.connector.connect(host ='localhost',user='root', database='tao',charset='utf8',use_unicode='true')
f = io.open("upload.xml",'w',encoding='utf-8')
f.write(row[dic['abs']]+"\n")
有人能帮我吗?我需要使用Python从数据库中检索所有数据并将它们输出到xml文件中
此外,我想知道为什么我可以成功地得到正确的结果(20°42'N,116°43'E)的php的回声?我已经使用mysql>;select…,对数据进行了检查,结果也是这样的:20,X42,116,X43
哎呀!我想你已经完成了拉丁1和big5字符集。
3230A2583432A1A64E
是CHARACETER SET latin1
3230A2583432A1A64E
是CHARACETER SET big5
3230C2B03432E280994E
是CHARACETER SET utf8
中20°42’N
的十六进制,这(我猜)就是您希望存储的内容。在处理拉丁语1和utf8已经足够了。但是把5块钱扔到混合料里会让我头晕目眩。在
mysql的连接愿意从任何编码转换为您为表/列声明的内容。但你必须正确地陈述。在
我想你有
big5
的数据进来了,但你声称是latin1
。在相关问题 更多 >
编程相关推荐