HTML, XHTML validation error - can't resolve

2019-07-20 07:46发布

I have been trying to validate my web page for the last two hours, I only have one error remaining before it is successfully validated but I keep on getting the character decoding problem, I cannot get round it.....

The whole document is fine except it says...

Sorry, I am unable to validate this document because on line 77 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.

The error was: utf8 "\x85" does not map to Unicode

The only thing on line 77 is some text inside some <p> tags, I have tried changing them to <a>, or <span> and taking the <p> away so it is just loose inside the div but the error only goes away when I delete the text inside the tags.

I am using the utf-8 encoding:

<meta http-equiv="Content-type" content="text/html;charset=utf-8" />

I am sorry if this is simple to resolve, my knowledge is extremely basic, I am only a first year computing student.

EDIT: the text inside the <p> tags are as follows:

      <p>Our team thrives on the latest political news as we do you. We work around the clock to bring you the latest, most important news as soon as it happens. What do we ask in return… nothing! This site is funded by us! Your satisfaction is as much a pay packet to us then a wad of untraceable counterfeit notes.<br/><br/>
     Sign up to our newsletter to get regular updates on news as soon as it happens without having to navigate to our site. For your security we only sell the details you input to our site to companies who “pinky promise” they won’t be naughty with them.<br/><br/>
     StudentPolitics.Now – Trading in satisfying others since 2011</p>

4条回答
相关推荐>>
2楼-- · 2019-07-20 08:10

validator did not like the three full stops after the word "return" three full stops after one another must mean something else...

Thank you for all your help guys.

查看更多
3楼-- · 2019-07-20 08:18

Save your document in a UTF format. If it already is, try copy-paste the source code to a new file and save it in UTF format (sometimes it can get stuck during edits in some programs).

What editor are you using?


EDIT: There are some non-standard characters in your text: (three dots in a single character, “” (curly braces), (curly apostrophe), (dash).

I guess you've copied your text from Word or a similar text processor, I get that often too. Either change those characters to their ASCII counterparts or HTML entities or be sure to save the file with UTF encoding.

查看更多
乱世女痞
4楼-- · 2019-07-20 08:29

The problem is that the document only claims to be UTF-8 but isn't really.

Configure your editor to save in that format (the W3C has a guide for a number of them).

If you modify the HTML programatically, then check the program (and/or database if one is in play) aren't munging the data or storing non-UTF-8 data.

If that doesn't work, then try deleting the text and retyping it. You might have a zero width character that can't be represented properly in there.

查看更多
We Are One
5楼-- · 2019-07-20 08:29

Sometimes when you generate query from a database the encoding of the characters may not be UTF-8 in that case you should make sure that the values returned in the queries match UTF-8, also sometimes when making a substring you can cut a character in Spanish as tildes and las ñ and to show incomplete the character.

For example check the source code in your browser

enter image description here

查看更多
登录 后发表回答