1

I'm new to Markdown and I instantly liked the idea of a readable plain text document with the ability to (rather) easily convert to html. Writing on plain-text editors is way better than in word processors! The thing is, I'm not familiar with the Perl language.

So I read basically all the documentation, starting with the point of origin (daringfireball by John Gruber) and then I installed Perl in my Windows 8 operating system so I could convert my .md files to html.
I used the ActivePerl-5.20.1.2000-MSWin32-x64-298557.msi version. To make the conversion, I used the following command in the console:

perl Markdown.pl input.txt > output.html

Problem is, I'm not a native English speaker, and my texts do have a lot of accented characters, like á, ã, ç, ô and so on.
So my output is a very ugly (and unreadable) text like:

Agora, um código com mais de um parágrafo

I've searched, but the closest I could find here was: Rendering unicode characters in Markdown from Emacs

How to make those non-ASCII characters show correctly?

Thanks!

Community
  • 1
  • 1
Da Rossa
  • 11
  • 2

2 Answers2

0

Add the below line before the print statements in your Perl program.

binmode(STDOUT, ":utf8");

Also see: How can I output UTF-8 from Perl?

Community
  • 1
  • 1
Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133
  • Thanks for your reply Chankey, sorry for the long time without a response. So, I tried you suggestion and appended your line before *each* Print statement. You said statementS! No luck. What did I miss? – Da Rossa Jan 20 '15 at 03:53
0

I suggest you switch to a more mature Markdown implementation, like for example Pandoc.

Pandoc supports UTF-8 and UTF-8 only.

pandoc -s -o output.html input.txt

A comparison between the two.

Karol S
  • 9,028
  • 2
  • 32
  • 45
  • Karol, thanks for your tip and sorry for the long time for my reply. I'll take a careful look at Pandoc. – Da Rossa Jan 20 '15 at 03:54