html_unescape 0.1.3 copy "html_unescape: ^0.1.3" to clipboard
html_unescape: ^0.1.3 copied to clipboard

outdatedDart 1 only

A small library for un-escaping HTML.

html_unescape #

A Dart library for unescaping HTML-encoded strings.

Supports:

  • Named Character References ( )
    • 2099 of them
  • Decimal Character References (á)
  • Hexadecimal Character References (ã)

The idea is that while you seldom need encoding to such a level (most of the time, all you need to escape is <, >, /, & and "), you do want to make sure that you cover the whole spectrum when decoding from HTML-escaped strings.

Usage #

A simple usage example:

import 'package:html_unescape/html_unescape.dart';

main() {
  var unescape = new HtmlUnescape();
  var text = unescape.convert("&lt;strong&#62;This &quot;escaped&quot; string");
  print(text);
}

If you're sure you will only encounter the most common escaped characters, you can import 'package:html_unescape/html_unescape_basic.dart' instead of the full version. This will decrease code size and increase performance. The only difference is in the size of the Named Character Reference dictionary. The full set includes the likes of &DownLeftRightVector; or &UpArrowBar;.

Issues #

Please use GitHub tracker. Don't hesitate to create pull requests, too.