Moodle
  1. Moodle
  2. MDL-20882

Replace all   entities with the unicode character

    Details

    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      XHTML served validly as application/xhtml+xml should be using the actual character, or   rather than   for non-breaking spaces.

      This is especially a problem for anyone wanting to use XHTML5 (which has a doctype of <!DOCTYPE html> with no DTD) because the page will stop rendering with an XML error when it encounters a  

      If Moodle is being served as utf-8 with a mime-type of application/xhtml+xml, it should always be using   or the unicode characters themselves.

        Gliffy Diagrams

          Activity

          Hide
          Darryl Pogue added a comment -

          These 3 patches should remove all   instances in the lib dir. It does not remove them from files in subdirs, and it could get complicated with the fact that we include non-Moodle libs such as TinyMCE and YUI.

          Show
          Darryl Pogue added a comment - These 3 patches should remove all   instances in the lib dir. It does not remove them from files in subdirs, and it could get complicated with the fact that we include non-Moodle libs such as TinyMCE and YUI.
          Hide
          David Mudrak added a comment -

          Well, if we wanted really "proper" solution of this, we must end with something like $OUTPUT->nbsp(); The proposed patch is just a tributary solution IMO.

          Show
          David Mudrak added a comment - Well, if we wanted really "proper" solution of this, we must end with something like $OUTPUT->nbsp(); The proposed patch is just a tributary solution IMO.
          Hide
          Martin Dougiamas added a comment -

          (I hate it when standards do seemingly arbitrary changes like this to make things easier for computers, the ones supposed to be doing the hard work for us!)

          What are the advantages of moving to XHTML5 already? (Out of interest)

          But generally I agree we should be moving to some sort of method or at least a define for something like this.

          Show
          Martin Dougiamas added a comment - (I hate it when standards do seemingly arbitrary changes like this to make things easier for computers, the ones supposed to be doing the hard work for us!) What are the advantages of moving to XHTML5 already? (Out of interest) But generally I agree we should be moving to some sort of method or at least a define for something like this.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Uhmm...

          is this one XHTML change so   (one HTML entity) has become invalid? Sounds unpretty strange (HTML entities not supported by HTML, lol).

          Or is this one problem in PHP, decoding   to something incorrect in UTF8-land in functions like html_entity_decode() and friends?

          I feel inclined (without any testing) that the 1st cannot be true, but the 2nd is a real threat: MDL-6202

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Uhmm... is this one XHTML change so   (one HTML entity) has become invalid? Sounds unpretty strange (HTML entities not supported by HTML, lol). Or is this one problem in PHP, decoding   to something incorrect in UTF8-land in functions like html_entity_decode() and friends? I feel inclined (without any testing) that the 1st cannot be true, but the 2nd is a real threat: MDL-6202 Ciao
          Hide
          Darryl Pogue added a comment -

          (X)HTML5 brings new, more semantic tags such as <header> and <footer>, as well as allowing <audio> and <video> tags.

          The issue is actually that the HTML entity is invalid in XHTML, not that it's using a wrong entity. You can see the error at http://dox.thss.ca/moodle/login/ on something as simple as the login page.

          $OUTPUT->nbsp() sounds like a good way to do it (and themes could override the default with a custom renderer). Maybe something even more generic like $OUTPUT->html_entity() which would accept a string and print out whatever the entity should be?

          Ex. $OUPUT->html_entity('nbsp") would return   but themes could override it to return  

          Show
          Darryl Pogue added a comment - (X)HTML5 brings new, more semantic tags such as <header> and <footer>, as well as allowing <audio> and <video> tags. The issue is actually that the HTML entity is invalid in XHTML, not that it's using a wrong entity. You can see the error at http://dox.thss.ca/moodle/login/ on something as simple as the login page. $OUTPUT->nbsp() sounds like a good way to do it (and themes could override the default with a custom renderer). Maybe something even more generic like $OUTPUT->html_entity() which would accept a string and print out whatever the entity should be? Ex. $OUPUT->html_entity('nbsp") would return   but themes could override it to return  
          Hide
          Darryl Pogue added a comment -

          Replace all &nbsp; instances with &#160; (along with replacing the © with &#169 in the top level of the admin directory.

          Show
          Darryl Pogue added a comment - Replace all &nbsp; instances with &#160; (along with replacing the © with &#169 in the top level of the admin directory.
          Hide
          Darryl Pogue added a comment -

          Tim indicated that using the actual unicode characters is probably better than dealing with entities at all.

          This patch replaces all my existing changes with the unicode characters rather than &#160;.

          Show
          Darryl Pogue added a comment - Tim indicated that using the actual unicode characters is probably better than dealing with entities at all. This patch replaces all my existing changes with the unicode characters rather than &#160;.
          Hide
          Mauno Korpelainen added a comment -

          Darryl,

          is there some particular reason for using XHTML5 ? MathML? Why not normal HTML5 that can use all html entities like   ?

          IE has never supported standard XHTML, though it can render XHTML documents authored with HTML compatibility principles and served with a text/html MIME-type.

          Therefore IE can't handle XHTML5 (maybe after 20 years...) and people will still use IE after 20 years...meaning that if we want to support IE we simply can't use XHTML5 - but we can use most features of HTML5 with IE.

          Show
          Mauno Korpelainen added a comment - Darryl, is there some particular reason for using XHTML5 ? MathML? Why not normal HTML5 that can use all html entities like   ? IE has never supported standard XHTML, though it can render XHTML documents authored with HTML compatibility principles and served with a text/html MIME-type. Therefore IE can't handle XHTML5 (maybe after 20 years...) and people will still use IE after 20 years...meaning that if we want to support IE we simply can't use XHTML5 - but we can use most features of HTML5 with IE.
          Hide
          Darryl Pogue added a comment -

          My use of XHTML5 is for inline SVG animations, and hopefully MathML. As you say, XHTML is not supported by IE, but with some extras (such as Google's SVGWeb JavaScript library), I'm able to achieve most of the same functionality.

          I think it's important for themes to be able to change the doctype and mime-types (within reason) and have Moodle support that.

          Show
          Darryl Pogue added a comment - My use of XHTML5 is for inline SVG animations, and hopefully MathML. As you say, XHTML is not supported by IE, but with some extras (such as Google's SVGWeb JavaScript library), I'm able to achieve most of the same functionality. I think it's important for themes to be able to change the doctype and mime-types (within reason) and have Moodle support that.
          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this issue.

          We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported.

          If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

          Michael d.

          TW9vZGxlDQo=

          Show
          Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d. TW9vZGxlDQo=
          Hide
          Michael de Raadt added a comment -

          I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported.

          This is being done as part of a bulk annual clean-up of issues.

          If you still believe this is an issue in supported versions, please create a new issue.

          Show
          Michael de Raadt added a comment - I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported. This is being done as part of a bulk annual clean-up of issues. If you still believe this is an issue in supported versions, please create a new issue.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: