decode character encoding of incoming templates