substack/node-ent — pull request #15 by dpolivy (2013-08-13 22:04:46+00:00)
Title: Add support for 'useNamedReferences' encoding option

I had a need to only encode with decimal entities, so I went ahead and modified the encode method as you suggested to take an alternate parameter to toggle this on/off. I also added some new tests, and updated the readme.

The encoding behavior is now consistent, as follows:
- Special ASCII characters are always encoded (& < > " ').
- "Normal" non-extended ASCII characters are not encoded.
- When `useNamedReferences` is `false`, extended characters (<32 && >= 127) are
encoded by name when available, and by number otherwise.
- When `useNamedReferences` is `true`, extended characters (<32 && >=127) are
always encoded by number.

This is a revised attempt at https://github.com/substack/node-ent/pull/6 based on the latest code and without the extraneous changes.

This should fix Issue https://github.com/substack/node-ent/issues/4.