简体   繁体   English

utf8字符出现离子问题

[英]ionic issue with utf8 characters

I'm facing with the problem that the text displayed in my <div> using ng-bind-html do not show some characters correctly. 我面临的问题是,使用ng-bind-html<div>显示的文本无法正确显示某些字符。

I get data from $.post where my php returns the excerpt using utf8_encode in json format. 我从$ .post获得数据,我的php使用utf8_encode以json格式返回摘录。

The fact is that the original text is: 事实是原始文本是:

Akinori Goto created this gorgeous 3D printed zoetrope that explores the relationship between time and movement. 后藤晃典(Akinori Goto)创造了这款华丽的3D打印的共沸物,探索了时间与运动之间的关系。 The design won both the Runner-up Grand Prix and the Audience Award at this year's Spiral Independent Creators Festival in Tokyo. 该设计在今年的东京螺旋独立创作者节上获得了亚军大奖赛和观众奖。

and what's rendered in my screen is: 在我的屏幕上呈现的是:

Akinori Goto created this gorgeous 3D printed zoetrope that explores the relationship between time and movement. 后藤晃典(Akinori Goto)创造了这款华丽的3D打印的共沸物,探索了时间与运动之间的关系。 The design won both the Runner-up Grand Prix and the Audience Award at this year’s Spiral Independent Creators Festival in Tokyo. 该设计在今年的东京螺旋独立创作者节上获得了亚军大奖赛和观众奖。

What can I do? 我能做什么?

Two things you can try: 您可以尝试两件事:

  • Add this to the <head> of your HTML page: <meta charset="UTF-8"> 将此添加到HTML页面的<head><meta charset="UTF-8">
  • Make sure you're not encoding the string twice! 确保您没有对字符串进行两次编码! Try removing utf8_encode from your PHP script (if the string is already UTF8 encoded you might not need to call that function). 尝试从您的PHP脚本中删除utf8_encode (如果该字符串已经采用UTF8编码,则可能无需调用该函数)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM