Link to home
Start Free TrialLog in
Avatar of Craig Lambie
Craig LambieFlag for Australia

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Craig Lambie

ASKER

Could you show me where it suggests that in the w3c?
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&
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).
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.

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&
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;
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;" ??
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;" ??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I managed to find the function and change it to the #160; version and it validated :)