根据每个文件或每个扩展更改编码 [英] Change encoding on a per file or per extension basis

查看:267
本文介绍了根据每个文件或每个扩展更改编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Microsoft Visual Studio Express 2012 for Web。看来我打开它的每个文件被编码为UTF-8。对于大多数将面向Web的文件,这很好。但是,我在我的项目中有专门用于构建目的的文件(例如 .bat 文件),必须在ANSI中编码。

I'm using Microsoft Visual Studio Express 2012 for Web. It seems that every file which I open with it gets encoded into UTF-8. For most files which are going to be web-facing, that's fine. However, I have files in my projects that are specifically for build purposes (e.g., .bat files), which must be encoded in ANSI.

在VS中有任何配置设置,以指定每个文件或每个扩展基础的编码?或者,如果不指定编码,至少禁用自动转换为UTF-8?

Are there any configuration settings in VS to either designate on a per file or a per extension basis the encoding? Or, if not specify the encoding, at least disable the auto-conversion to UTF-8?

推荐答案

可以在选项对话框中配置每次打开基础上给定扩展名的所有文件的编码。请参见选项,文本编辑器,文件扩展名上的MSDN页面。

An option to handle the encoding of all files of a given extension on a per open basis can be configured in the Options dialog. See MSDN page on Options, Text Editor, File Extension.

导航到工具>选项>文本编辑器>文件扩展名

>扩展程序我选择了具有编码的源代码(文本)编辑器。具有编码部分的意味着在打开文件时,用户将被给予关于使用什么编码的选项。此模式中的默认设置为自动检测,如果这是文件已经使用的,则会保留ANSI编码。

For the bat extension I selected Source Code (Text) Editor with Encoding. The with Encoding part means that when opening the file the user will be given options as to what encoding to use. The default in this mode is Auto-detect, which preserves the ANSI encoding, if that is what the file already uses. Otherwise, one can explicitly designate it for the individual file.

不幸的是,它似乎不记得打开文件时最后使用的设置,因此会提示输入每次编码设置

Unfortunately, it doesn't seem to remember the setting last used when opening a file, and will thus prompt for an encoding setting everytime a file is opened.

这篇关于根据每个文件或每个扩展更改编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆