html2text.py: Python 2.5 compatibility, improve Unicode support
authorPeter Wu <peter@lekensteyn.nl>
Wed, 25 Mar 2015 19:51:01 +0000 (20:51 +0100)
committerAnders Broman <a.broman58@gmail.com>
Thu, 26 Mar 2015 07:14:20 +0000 (07:14 +0000)
commit13c486c33f9d3a015aaf0e4ee0c99643575cd235
treee642365ba3a64564c35810d70100b70da09e8330
parent785fab7f01c98c54295596d4a25a2d2bc7343335
html2text.py: Python 2.5 compatibility, improve Unicode support

Add support for Python 2.5 (remove unicode_literals import which does
not seem to be necessary), check before using break_on_hyphens (without
this option in Python 2.5, the output is uglier though) and avoid the
'with' keyword.

While at it, fix reading Unicode text from file in Python 2 (tested
with: echo € | tools/html2text.py) and support reading from stdin using
the '-' filename.

Tested against Python 2.5.6, 2.6.6, 2.7.9, 3.2.6, 3.4.3 with the
commands from the previous html2text.py commit message, and additionally
with the Unicode character € as input (instead of the faq.py output).

Change-Id: I3de3f7a4e7cf7d702463c3a59758803843338a54
Reviewed-on: https://code.wireshark.org/review/7823
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
tools/html2text.py