且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

(HTML5)使用UTF-8时无法显示汉字

更新时间:2023-01-30 22:40:22

您似乎已将源代码保存在Big5中.您应该

You seem to have saved your source code in Big5. You should either

  • 将您的源代码另存为UTF-8,或者
  • 对非ASCII字符使用Unicode转义码.

如果您更喜欢使用转义码,则您的示例可以写为:

If you prefer to use escape codes, your example can be written as:

context.fillText('\u4e2d\u6587', 0, 0);