Search code examples
doctypemobile-websitew3c-validationxhtml-mp

Why does this XHTML-MP code not pass W3C validation?


Wikipedia's example of XHTML-MP:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
  "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Hello</title>
  </head>
  <body>
    <p>Hello <a href="http://example.org/">world</a>.</p>
  </body>
</html>

This fails W3C validation with the error Input is not proper UTF-8, indicate encoding ! Bytes: 0xA9 0x20 0x32 0x30

Even if you add <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> and tell the validator it's UTF8, it gives this error.

If the XHTML-MP DOCTYPE is removed, it works fine. What is the deal?


Solution

  • The problem is with the external DTD. If you change the DOCTYPE to this, it validates:

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
    "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">