Character entity reference converter using JavaScript

Version 1.2007.11.21 by Dave Smith

Paste or type text into the text area, then choose a control or press ctrl + space for a default action.

The ctrl (windows) or command (mac) key gives focus to the text area. Therefore the keyboard shortcuts for select all, cut, copy and paste work with respect to the text area.

Notes

Would be good to let queries set the options and have a redirect based on the options.

Controls

|

|

Convert with the following options:

Replace all occurences of ' - ' with ' – '
Replace all occurences of x in ' nx ', 'nx ' or 'n x ' with ' × '
Replace all occurences of ‘ and ’ with '
Replace all occurences of “ and ” with "
Replace all occurences of ` and ´ with '
Replace all occurences of ... with …
Replace all occurences of ‒ with – Unfinished

Text area

Application details

Controls with the order of the sub-routines

Tidy

  1. Removes spaces at the end of line or paragraph; before a line feed, carriage return or form feed
  2. Replaces occurances of 3 spaces with 1 space
  3. Replaces occurances of 2 spaces with 1 space
  4. Removes white-space characters from the beginning and end of the text

Convert

  1. Replace all occurences of & with &
  2. Replace all characters listed in the entity table with equivalent entities
  3. Run optional routines
    1. Space hyphen space
    2. Straighten quotes
    3. Dot dot dot

Revert

  1. Replace all entities listed in the entity table with equivalent characters
  2. Replace all occurences of &amp with &

Tidy and convert

  1. Runs Tidy then Convert

Space hyphen space

  1. Replace all occurences of ' - ' with ' – '

Straighten quotes

  1. Replace all occurences of ‘, ’, ‘ and ’ with '
  2. Replace all occurences of “, ”, “ and ” with "

Dot dot dot

  1. Replace all occurences of ... with …

The entity table

This table is created by JavaScript after the page has loaded.