Bug 12558 - Support HTML's full set of character entities in SVG
Summary: Support HTML's full set of character entities in SVG
Alias: None
Product: SVG
Classification: Unclassified
Component: DTD (show other bugs)
Version: SVG 2.0
Hardware: All All
: P2 enhancement
Target Milestone: Test Suite
Assignee: Doug Schepers
QA Contact: SVG Public List
Depends on:
Reported: 2011-04-26 14:58 UTC by Payman Delshad
Modified: 2012-01-10 23:27 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Payman Delshad 2011-04-26 14:58:51 UTC
Currently SVG supports only the XML's predefined entities listed in http://www.w3.org/TR/REC-xml/#sec-predefined-ent

So if one needs to use an entity other than the aforementioned (e.g. −), the solutions are:
1. Using the relevant random mess of hex wrapped in punctuators.
2. Fetching the actual character from a character map (not all entities are readily available using a standard keyboard layout) and specifying encoding="utf-8".

I think it makes sense to extend the spec and support HTML's full set of character entities in SVG.
Comment 1 Cameron McCormack 2011-04-28 03:56:57 UTC
Note that some people replied to the bugmail on www-svg:

One more solution is to have a DTD that defines these entities, and to reference this from your document.

  <!DOCTYPE svg PUBLIC "blahblah" "http://www.w3.org/somewhere/whatever.dtd">
  <svg xmlns="http://www.w3.org/2000/svg">
    <text y="20">a &minus; b</text>

It's not a great long term solution, since we are moving away from DTDs.  If processors don't recognise the public ID, then the XML processors will have to be operating in validating mode to download the DTD, which many won't.

If we want to allow documents like

  <svg xmlns="http://www.w3.org/2000/svg">
    <text y="20">a &minus; b</text>

without the DOCTYPE declaration, then this would require a change at the XML layer level.  Some people think this is the right way to solve this problem, too.

Remember that with SVG in text/html, all of HTML's entities will work already:

  <!DOCTYPE html>
    <text y="20">a &minus; b</text>

Comment 2 Chris Lilley 2012-01-10 23:27:29 UTC
Discussed at SVG f2f Manly, Jan 2012. Scope is greater than SVG; we don't want an SVG specific XML parsing mode or to break existing XML workflows. The HTML entity set is fairly small, with poor Unicode coverage; in general people will need to type the characters needed. 

For specific entities,the internal DTD subset is always available (and may be quite useful for nbsp, znj,zwnj and suchlike non-visible characters).

It is possible that later work (such as XML5) will solve this and if so, SVG could benefit from that in the future.