Bug fix: encode strings properly in Template.py

If a template includes a function that returns a unicode string, such as
the Zambretti forecaster in some languages, the string wasn't being
converted before writing to file. It now gets converted using the
locale's preferred encoding, or Latin-1 if the locale has no preference.