特殊字符显示不正确 [英] Special character is not displaying properly

查看:58
本文介绍了特殊字符显示不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TextArea 中,我使用了 ' 字符,但它没有正确显示.相反,它显示如下内容:.

如何让 ' 字符正确显示?

解决方案

您可能使用的不是 Ascii 撇号 ('),而是一些非 Ascii 标点符号,例如正确的标点撇号 (').出现问题是因为您的 HTML 文档(可能)是 UTF-8 编码的,但浏览器将其解释为 windows-1252 编码.如果没有在 HTTP 标头中声明编码,将标签 添加到 head 部分会有所帮助.有关编码的一般建议,请参阅 W3C 页面 字符编码.>

textarea 元素用于用户输入.为了呈现您的内容,其他元素(可能使用 CSS 设置样式)通常是更好的选择.但是,编码问题是一样的.

In a TextArea, I am using the ' character but it is not displaying properly. Instead, it is displaying something like this: â€".

How do I get the ' character to display properly?

解决方案

You are probably not using the Ascii apostrophe (') but some non-Ascii punctuation mark, such as the correct punctuation apostrophe (’). The problem arises because your HTML document is (probably) UTF-8 encoded but the browser interprets it as windows-1252 encoded. If there encoding is not declared in HTTP headers, adding the tag <meta charset=utf-8> into the head part would help. For general advice on encodings, see the W3C page Character encodings.

The textarea element is meant for user input. For presenting your content, other elements (possibly styled with CSS) are usually a better choice. However, the encoding issue is the same.

这篇关于特殊字符显示不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆