erebor/asciidoctor — pull request #27 by mojavelinux (2012-12-20 08:27:05+00:00)
Title: Set encoding in document template to utf8 and test it

I had like a triple "aha!" moment on this.

My first thought was "If the asciidoc_index.txt file hasn't been updated, why is it failing already?"

Aha #1. While we load the asciidoc_index.txt file in a test, we never attempt to render it :)

Thus, we know that the issue began when a gsub was added to the output in render_templates.rb.

Second thought, "Why does the gsub matter there and not anywhere else we are touching the text?"

Aha #2. ERB does not default to utf-8 encoding. You have to explicitly set the encoding using a directive.

Finally, "Could I verify that in fact we found a scenario we were not testing and that a recent change probed into that problem?"

Aha #3. Writing a test (as is) that attempts to render a document with a utf-8 character causes the test to fail. By adding the aforementioned directive to the document ERB template, the test passes. Green bar!

Here's the line that needed to be added to the outer-most ERB template:

```
<%#encoding:UTF-8%>
```