[1.7.x] Fixed #22773 -- Forced templatize() to return unicode

Backport of daaeb84158 from master.