inclusive-design / AChecker

Automated interactive Web content accessibility checker.
https://achecker.ca
GNU General Public License v2.0
69 stars 61 forks source link

Undefined entity #26

Closed astuanax closed 11 years ago

astuanax commented 11 years ago

Hi,

In some cases where the webpage is served with XHTML, UTF-8, but really serving ISO-8859-1, the XML that is returned, when selecting output=REST, becomes invalid.

It is full of â entities. [quote]It is an encoding issue. The non-breaking space, encoded in UTF-8 (the document makes the claim to be in UTF-8) is hex C2A0 (two bytes) but in ISO-8859-1 it is hex A0 (one byte). My browser thinks your page is ISO-8859-1. This is due to the Content-type header being incorrect.[quote] http://ncsuwebdev.ning.com/forum/topics/the-case-of-the-mysterious

I would suggest the following change as shown in this diff:

--- RESTWebServiceOutput.class.php (saved version) +++ (current document) @@ -36,7 +36,7 @@

// REST templates
var $rest_main =

-'<?xml version="1.0" encoding="ISO-8859-1"?> +'<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE resultset[ <!ELEMENT resultset (summary,results)> <!ELEMENT summary (status,sessionID,NumOfErrors,NumOfLikelyProblems,NumOfPotentialProblems,guidelines)> @@ -65,6 +65,7 @@ <!ENTITY amp "&#38;"> <!ENTITY apos "'"> <!ENTITY quot """> +<!ENTITY nbsp " " > ]>

@@ -225,7 +226,7 @@ $error['check_id'], htmlentities(_AC("suggest_improvements")), htmlentities(_AC($row_check['err'])), - htmlentities($error["html_code"]), - htmlentities(utf8_decode($error["html_code"])), $repair, $decision), $this->rest_result); @@ -340,7 +341,7 @@ public static function generateSuccessRpt() { $rest_success = -' +' success
cindyli commented 11 years ago

Makes sense.

Would you mind sending a pull request with this fix?

Thanks.

astuanax commented 11 years ago

Ok, I hope I managed to get this pull-request right. Let me know if it worked, or if you need anything else. https://github.com/atutor/AChecker/pull/28

Thx / Len.