scottybwoy Posted August 8, 2008 Share Posted August 8, 2008 I seem to have stumbled upon an issue, that I have been trawling around the web for only to return with more confusion. I tried running W3C HTML Validator on this e-commerce site I've been working on, and it returned this error : Sorry, I am unable to validate this document because on line 284 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 "\xA3" does not map to Unicode I had a look at the output and line 284, it is just a comment block, like many others in the same file. I tried converting the php file to UTF8 encoding but that just cocked up how the file executed (strange). But I really don't know what the problem is. All other sites php generated pages can be validated. My doctype declaration is correct. Could is be something to do with the server? I'm really lost, anyone solved this before? Quote Link to comment Share on other sites More sharing options...
obsidian Posted August 8, 2008 Share Posted August 8, 2008 We have run into similar things with character and byte reading issues at work, because we have to keep all our stuff unicode compliant for our internationalization. Out of curiosity, what is contained within the comment block (non-alpha characters, specifically). If I remember right, /xa3 is a pound sign, but I can't remember for sure. It seems as though the output to the page is not utf-8 compliant. It is also possible that the W3C validator may have the wrong mapping for a specific character (unlikely but possible). If you don't mind posting the comment block, that may help some. Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted August 8, 2008 Author Share Posted August 8, 2008 The comment block is fairly standard <!-- footer //--> Although one guy did have the same issue, deleted the comment block and left a blank line, and it still reported an error on that line. I posted a link to the site, so people can see for themselves what is going on. Thanks. Quote Link to comment Share on other sites More sharing options...
obsidian Posted August 8, 2008 Share Posted August 8, 2008 OK, for kicks, let's just ignore the line number for a minute, because who knows what the validator does to break up the code. From my quick Google search, it seems that your error is on the pound symbol on your pages. The following code supposedly puts out a valid pound symbol: <?php echo utf8_encode("\xa3"); ?> That's the value you're getting in your error, too... Anywhere you're trying to echo utf8 compliant characters differently? I know it's a shot in the dark, but it's worth a try. Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted August 12, 2008 Author Share Posted August 12, 2008 Hi Obsidian, Sorry I've been doing other stuff, but I have come back to it and found that when I replace the pound sign with what you suggested, it displays the '£' symbol. Sorry, I'm not to hot on this area and am getting confused as to what parts get encoded when and for where? Thanks for your help though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.