江南白衣

陌上發花,可以緩緩醉矣
忍把浮名,換了淺斟低唱
我不是聖賢豪士,我衹有一腔熱血
posts - 113, comments - 422, trackbacks - 14, articles - 0
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

CodeSmith不能保存中文的解决办法

Posted on 2007-03-05 13:44 江南白衣 阅读(348) 评论(0)  编辑 收藏 所属分类: Tools
昨天在用ActiveRecord Template的时候发现CodeSmith不能正常输出中文,解决方法如下:
设置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.

ResponseEncoding
    The ResponseEncoding attribute is used to set the encoding for the template content and it's outputs.  The ResponseEncoding attribute supports values from the System.Text.Encoding.GetEncoding method.  By default, the encoding is set to ASCII.


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2007-03-05 14:06 编辑过


相关链接: