"Entity 'reg' not defined error" ® XHTML Mobile 1.2

Craig Lambie
Craig Lambie used Ask the Experts™
on
Hi experts,

I am getting a validation error for "®" HTML entity when I use this DocType below.
Any ideas on how to avoid this from appearing?
DocType
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">

Open in new window

Validation Error Appearing on this line
<a href="http://www.s2member.com/" onclick="window.open('http://www.s2member.com/s-badges/s-details.php?v=1&amp;site_url=http%3A%2F%2Fm.truesecrets.com.au%2Fstrange-tours-melbourne', '_popup', 'width=752,height=702,left='+((screen.width/2)-(752/2))+',screenX='+((screen.width/2)-(752/2))+',top='+((screen.height/2)-(702/2))+',screenY='+((screen.height/2)-(702/2))+',location=0,menubar=0,toolbar=0,scrollbars=0,resizable=1'); return false;" title="s2Member&reg;"><img src="//www.s2member.com/s-badges/s-badge.php?v=1&amp;site_url=http%3A%2F%2Fm.truesecrets.com.au%2Fstrange-tours-melbourne" style="border:0;" alt="s2Member&reg;" title="s2Member&reg; ( Security for WordPress&reg; )" /></a>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IIRC HTML Entities are not supported (even not valid) in HTML tag attributes.

Author

Commented:
Could you show me where it suggests that in the w3c?
Top Expert 2013

Commented:
It is not a w3c standard it is a IETF standard.

The relevant standard is RFC1738 (IETF) which specifies that an ampersand in a url should be encoded as  %26.

There is a list of the url encoded values HERE


Cd&
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

ok, we need to be pedantic:
  the reference is http://www.rfc-editor.org/rfc/rfc1866.txt
see 3.2.4. Attributes
Not sure if there is a newer RFC which defines this different.

HTML Entities in the attribute value must be written as NCR (numeric character reference),
exceptions are only the SGML NCE (named character entity) &amp; &lt; &gt; and (depending
on the implementation of the tool) &quot;

It's all about HTML here according the example in the question), not URL or URI, or URL/URI inside HTML tag attributes (which are a different cumbersome story).
Top Expert 2013

Commented:
You are correct in saying that this is a tagging issue not a url issue I think I read it wrong.  I saw the ampersand being used as separator and thought that was the issue.


In 8.2.1 of RFC1866 there is a note:

"  NOTE - The URI from a query form submission can be
            used in a normal anchor style hyperlink.
            Unfortunately, the use of the `&' character to
            separate form fields interacts with its use in SGML
            attribute values as an entity reference delimiter.
            For example, the URI `http://host/?x=1&y=2' must be
            written `<a href="http://host/?x=1&y=2"' or `<a
            href="http://host/?x=1&y=2">'.

            HTTP server implementors, and in particular, CGI
            implementors are encouraged to support the use of
            `;' in place of `&' to save users the trouble of
            escaping `&' characters this way."

I was working on another question where there is an issue with apersand as part of the url and I read this one too quickly and thought it was the same issue.  I apologize for sidetracking the question.

Cd&
> .. , CGI
            implementors are encouraged to support the use of
            `;' in place of `&' to save users the trouble of

nice catch!
How many modern web/application servers still comply to that RFC (my guess: none).
I only know from ancient Netscape which did it that way too.
And perl's CGI.pm is still RFC compliant ;-)

Anyway, this is about URL/URI which is not the case in the question.

Top Expert 2013

Commented:
I always use ; because & requires shift and stretch up to the top row of the keyboard and I am a lazy typist. ;^)

So I reserve & for entities and signatures.


Cd&

Author

Commented:
Ok, so I am a little lost now.

The issue I have is with validation for "&reg;" the only other option I can see is to use "&#174;"

This is some sort of limitation with the DTD, not really anything to do with RFC 1866, URI/ URL.
I simply want the mobile browsers to correctly render the HTML on this page

http://m.truesecrets.com.au/strange-tours-melbourne/ (the page with the "@reg;" on it isn't public sorry, but similar DTD related validation errors on this page)

so you also get validation errors for &#174; or &#xae;

Author

Commented:
the application that is putting the "&reg;" entity in place I don't have control over, so for now I have disabled it.
I am not sure what you mean by "&#xae;" ??

Author

Commented:
the application that is putting the "&reg;" entity in place I don't have control over, so for now I have disabled it.
I am not sure what you mean by "&#xae;" ??
NCR (numeric character reference) can be written dezimal &#174; or hex &#xae;

> .. don't have control over,
if you can't control, you're probably lost here

Author

Commented:
I managed to find the function and change it to the #160; version and it validated :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial