colinta / SublimeStringEncode

Converts characters from one "encoding" to another using a transformation (think HTML entities, not character encodings)
Other
150 stars 22 forks source link

Don't properly handle ' #33

Closed loganmzz closed 7 years ago

loganmzz commented 7 years ago

Entitize

Source: <root attribute='value'/> Expecting: &lt;root attribute=&apos;value&apos;/&gt; Actual: &lt;root attribute=&#039;value&#039;/&gt;

Deentitize

Source: &lt;root attribute=&apos;value&apos;/&gt; Expecting: <root attribute='value'/> Actual: <root attribute=&apos;value&apos;/>

Tested on: SublimeText 3 Build 3126, StringEncode 2.2.1

colinta commented 7 years ago

The reason I chose &#039; is because &apos; is only supported in HTML5, it's (sadly) not on the official list of entities for HTML4.

It'd be pretty easy to add the deentitize support, not sure how to add support for apos and retain backwards compatibility. Package config setting?

colinta commented 7 years ago

for reference: https://www.w3.org/TR/html4/sgml/entities.html

loganmzz commented 7 years ago

I least I would have make it work for XML (https://www.w3.org/TR/xml-entity-names)

colinta commented 7 years ago

I looked at that doc, I don't see any mention of &apos; or &#034;, not sure what to do with that link.

loganmzz commented 7 years ago

Look at this page : https://www.w3.org/TR/xml-entity-names/bycodes.html

colinta commented 7 years ago

Cool, I'll update the xml entities to use apos.

colinta commented 7 years ago

Added &apos; support in version 2.2.2. XML will always use apos, and HTML supports it when deentitizing (still uses &#034; when entitizing).