Utf8 and CodeSmith

Posted by Miha Markič on April 30, 2006 · 1 min read

If you are dealing with non-ASCII fonts in [CodeSmith] templates or their outputs then you probably noticed that non-ASCII chars are replaced with question marks. There is a cure though.


Place ResponseEncoding="utf-8" attribute in <%@ CodeTemplate %> node of cst file (CodeSmith template) like this:



That's it. Both [CodeSmith] source file and output will happily contain all of your weird chars (why is there a need for non-ASCII anyway ;-))