Unicode safe encoding for template params.