Today I tried to use the nice Markdown Bundle, I drag-and-dropped an html file on an open window and here is what I got:
Traceback (most recent call last): File "/Library/Application Support/TextMate/Bundles/Markdown.tmbundle /Support/bin/html2text.py", line 395, in <module> html2text_file(data) File "/Library/Application Support/TextMate/Bundles/Markdown.tmbundle /Support/bin/html2text.py", line 379, in html2text_file h.feed(html) File "/Library/Frameworks/Python.framework/Versions/2.5/lib /python2.5/sgmllib.py", line 99, in feed self.goahead(0) File "/Library/Frameworks/Python.framework/Versions/2.5/lib /python2.5/sgmllib.py", line 188, in goahead self.handle_entityref(name) File "/Library/Application Support/TextMate/Bundles/Markdown.tmbundle/Support/bin/html2text.py", line 168, in handle_entityref self.o(entityref(c)) File "/Library/Application Support/TextMate/Bundles/Markdown.tmbundle/Support/bin/html2text.py", line 368, in o self.out(data) UnicodeEncodeError: 'ascii' codec can't encode character u'\xc0' in position 0: ordinal not in range(128)
Regards, Piero
On Oct 23, 2007, at 12:03 PM, Piero D'Ancona wrote:
Today I tried to use the nice Markdown Bundle, I drag-and-dropped an html file on an open window and here is what I got:
After seeing this message, I tried as well since I will have a need for this command soon. (For testing, I used the default index.html in `~/Sites/`.) I got similar errors. I have he Markdown bundle checked out to `/Library/Application Support`, so I removed that one and let the `/Applications/TextMate` version take over. There were still errors:
Traceback (most recent call last): File "/Applications/TextMate.app/Contents/SharedSupport/Bundles/ Markdown.tmbundle/Support/bin/html2text.py", line 395, in ? html2text_file(data) File "/Applications/TextMate.app/Contents/SharedSupport/Bundles/ Markdown.tmbundle/Support/bin/html2text.py", line 379, in html2text_file h.feed(html) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/sgmllib.py", line 95, in feed self.goahead(0) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/sgmllib.py", line 177, in goahead self.handle_charref(name) File "/Applications/TextMate.app/Contents/SharedSupport/Bundles/ Markdown.tmbundle/Support/bin/html2text.py", line 165, in handle_charref self.o(charref(c)) File "/Applications/TextMate.app/Contents/SharedSupport/Bundles/ Markdown.tmbundle/Support/bin/html2text.py", line 368, in o self.out(data) UnicodeEncodeError: 'ascii' codec can't encode character u'\x97' in position 0: ordinal not in range(128) ![Mac OS X Logo][1]
# Your website here.
You can use Mac OS X Personal Web Sharing to publish web pages or share files on the Internet
--- Rob McBroom http://www.skurfer.com/ I didn't "switch" to Apple... my OS did.
On 23/10/2007, at 18:03, Piero D'Ancona wrote:
Today I tried to use the nice Markdown Bundle, I drag-and-dropped an html file on an open window and here is what I got: [...] UnicodeEncodeError: 'ascii' codec can't encode character u'\xc0' in position 0: ordinal not in range(128)
Yeah, Python will barf at any non-ASCII (0-127) character it sees unless the encoding is explicitly set to something that allows the character -- so here your document has some non-ASCII character (\xC0 = À in latin-1) and the python script does not properly tell Python that the input is in whatever encoding your HTML document was in.
The current HTML → Markdown script is a little fragile in other regards as well. Recently a PHP version of the same functionality was made public and I am planning to switch to that script instead.