开发者

Special characters are not supported

开发者 https://www.devze.com 2022-12-11 03:33 出处:网络
I am having problem to display the special characters like ’, é 开发者_运维知识库in Firefox and IE. But these characters are supported for the local server.

I am having problem to display the special characters like ’, é 开发者_运维知识库in Firefox and IE. But these characters are supported for the local server.

I have used the following

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

Can anyone suggest me what the might be? Thanks in advance.


You've set the charset to iso-8859-1 - are you sure that's how they're encoded in your HTML?

In Firefox, try changing the charset using View -> Character Encoding (for your page it should have "Western (ISO-8859-1)" selected), and see if it works with another character encoding. If it does, consider either re-encoding your HTML into UTF-8, or changing the charset in your meta tag.


As Dominic says, checking you're encoding your HTML with the right charset in your meta tag would be the first step. There's info on charsets and encoding here. Whether you need to change the charset meta tag depends on the language the page is in. If your page is in English but just has the odd character that needs accents etc., the easiest way is to use the character code, for example the character code for é is &eacute; One of the many lists of character entities available online can be found here.

Alternatively, if your page is basically in English, but has small sections in another language, CSS2 has a lang attribute that can be used to style text in other languages appropriately. There's more info about the four different ways to apply language styles here. You can use the :lang() pseudo-class selector, the [lang |= "..."] selector that matches the beginning of the value of a language attribute, the [lang = "..."] selector that exactly matches the value of a language attribute, or a generic class or id selector.

If a small portion of your site was in another language such as Hebrew, you could also use CSS and a span to signify a change in the reading direction of the text, for example:

<p style="direction: rtl; unicode-bidi: embed;">
This is a paragraph written right-to-left.
</p>

or

<p>
This paragraph is written left-to-right except for <span style="direction: rtl; unicode-bidi: bidi-override;">these words</span> which were written right-to-left.
</p>

These examples (taken from here) show the style being applied inline, but you could also set the styles up in an external stylesheet).


You've set the charset in the document's meta tag, which works when you're viewing it as a file, but if the web server is providing a charset value, that takes priority. Check the HTTP headers that the web server is providing; one way is with the Firefox extension Live HTTP Headers. If it's something different, you have to tell the web server what you're doing or else reencode the document to match.

How to set the encoding varies between web servers. Apache, for example, lets you specify the charset globally, per-file in .htaccess, or by renaming the file to example.html.latin1.


Use HTML Entities like &aacute; or &#225; and the browser should sort it out.

Here is a list:

http://www.utexas.edu/learn/html/spchar.html


change your encoding meta tag to:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
0

精彩评论

暂无评论...
验证码 换一张
取 消