[TxMt] Markdown bundle unicode problem?

Allan Odgaard throw-away-2 at macromates.com
Wed Oct 24 19:37:08 UTC 2007


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.





More information about the textmate mailing list