This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12558 - Support HTML's full set of character entities in SVG
Summary: Support HTML's full set of character entities in SVG
Status: RESOLVED WONTFIX
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
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 14:58 UTC by Payman Delshad
Modified: 2012-01-10 23:27 UTC (History)
2 users (show)

See Also:


Attachments

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:
http://lists.w3.org/Archives/Public/www-svg/2011Apr/0067.html

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>
  </svg>

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>
  </svg>

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>
  <title>hello</title> 
  <svg>
    <text y="20">a &minus; b</text>
  </svg>

http://livedom.validator.nu/?%3C!DOCTYPE%20html%3E%0A%3Ctitle%3Ehello%3C%2Ftitle%3E%20%0A%3Csvg%3E%0A%20%20%3Ctext%20y%3D%2220%22%3Ea%20%26minus%3B%20b%3C%2Ftext%3E%0A%3C%2Fsvg%3E
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.

http://www.w3.org/2012/01/10-svg-irc#T23-26-38