[PTFM-11713] Text encoding fixes for templating utils