Encoding issues with XMLWriter (PHP)

本秂侑毒 提交于 2019-12-01 10:30:44

I'm not sure where you got the idea that XMLWriter converts encodings. It doesn't. You must supply it with utf-8. It can output different encodings, but input strings must be utf-8.

One of two things may be going on here:

  1. Whatever you are using to view your output document is interpreting the string as win-1252. If you are viewing your output in a browser, you may need to set the content-type header like so: header('Content-Type: application/xml; charset=UTF-8');
  2. You stored your data in your database incorrectly, and your "é" is actually two unicode characters "é". Fixing this is difficult.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!