doujishan2247 2012-05-01 10:51
浏览 63

使用PHP编码UTF-16的XML(我不断获得UTF-8)

I have a PHP script that extracts an XML file from a MYSQL. I have the following line:

$xml='<?xml version="1.0" encoding="UTF-16"?>;

But the extracted file is being recognized as UTF-8 UNIX (LF): enter image description here

I need to have the encoding as UTF-16 and Windows CLRF. What is the correct syntax?

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • dpd7195 2012-05-01 12:03
    关注

    add a HTTP header:

    header('Content-type: text/xml; charset=utf-16')
    

    I'm not sure if text/xml is the best for you, you should decide it: http://www.petefreitag.com/item/381.cfm

    Also, your editor in the screenshot is set to UTF-8

    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 R语言shiny包和ncdf4包报错
  • ¥15 origin绘制有显著差异的柱状图和聚类热图
  • ¥20 simulink实现滑模控制和pid控制对比,提现前者优势
  • ¥30 开发一款闲置物资借用管理软件
  • ¥15 (有偿)1500/怎么让网络延迟网速不变/需要做成软件/
  • ¥15 空调变频器板怎么测试可靠性和性能
  • ¥15 uniapp开发:微信小程序使用drawImage绘制第二次时不生效?
  • ¥500 tdx winner 函数计算公式,需和官方一样,1000元
  • ¥15 word 样式管理树状设计
  • ¥15 中国json地图的点击事件