[WIP] Fix a bug with handling of unicode characters when rendering parameters

This has been exposed by the Twitter sensor - https://gist.github.com/Kami/cbb13fa19fe0e1e347e1.

Thing would blow up when substituting named parameters with values if a value contained a non-ascii (unicode) character.

There are still some weird unicode-related issues later in the pipeline which I'm still trying to track down.