Nanoc, Unicode and UTF-8

When using Nanoc, if you get weird characters in your HTML in place of some special characters or accented letters, you may well need to change your character encoding.

An example is ÔÇö instead of — (an em-dash).

First check your source file is in UTF-8. For example, you can use the Encode in UTF-8 without BOM setting on the Encoding menu in Notepad++.

Then you want to make sure your Nanoc configuration file is properly set up (it is not set to use UTF-8 by default in recent versions). To do this, add encoding: utf-8 to the data_sources section of your configuration file (either config.yaml or nanoc.yaml in your Nanoc base directory). The result should give you something like this:

data_sources:
  -
    type: filesystem_unified
    encoding: utf-8

These steps and more are outlined in the Nanoc troubleshooting guide.

Tags: