HTML filter insert non-empty <meta> in some cases

Issue #212 resolved
Former user created an issue

Original [issue 212](https://code.google.com/p/okapi/issues/detail?id=212) created by @ysavourel on 2012-02-17T12:04:57.000Z:

The HTML filter inserts non-empty <meta> elements for declaring the encoding when it's absent. This is not compatible with XHTML. It should insert an empty element <meta /> or none at all.

Comments (6)

  1. Former user Account Deleted
    • changed status to open

    Comment [2.](https://code.google.com/p/okapi/issues/detail?id=212#c2) originally posted by @ysavourel on 2012-02-17T16:03:59.000Z:

    <meta/> should always be legal - even in normal broken html - from examples I have seen at least.

    The problem is not the broken HTML, it’s the valid HTMLs: I’ve check a sample file in the W3C validator:

    Using <meta /> in HTML is an error:

    And the description is: “The sequence <FOO /> can be interpreted in at least two different ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict, the '/' terminates the tag <FOO (with an implied '>'). However, since many browsers don't interpret it this way, even in the presence of an HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure HTML documents and reserve its use solely for those written in XHTML.”

    We don’t want to break valid files.

    This assuming xhtml will always have a proper xml encoding declaration.

    It can be a default declaration (UTF-8). So I don't think all XHTML will have a declaration. But all XHTML should have a namespace declaration. That could be our clue.

    As far as custom formats would an option be better as we don't know for each custom format what the right thing to do is?

    +1, By default we should do nothing. Like in the case of MapCap the custom XML format has probably a normal XML declaration.

  2. Log in to comment