昨天在用ActiveRecord Template的时候发现CodeSmith不能正常输出中文,解决方法如下:
设置CodeSmith tools->option->Enable unicode support
在模板中加入“ResponseEncoding="UTF-8" ”:
<%@ CodeTemplate Language="C#" ResponseEncoding="UTF-8" %>
CodeSmith的文档是这么说的:
ResponseEncoding
设置CodeSmith tools->option->Enable unicode support
在模板中加入“ResponseEncoding="UTF-8" ”:
<%@ CodeTemplate Language="C#" ResponseEncoding="UTF-8" %>
CodeSmith的文档是这么说的:
Q. What if my template contains non-ASCII characters?
A. You can use the ResponseEncoding attribute of the CodeTemplate directive to set the encoding for the template.