如何确定在Windows / IIS文件编码? [英] How can I determine file encodings on Windows / IIS?

查看:139
本文介绍了如何确定在Windows / IIS文件编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从答案<一个href=\"http://stackoverflow.com/questions/2453647/why-are-accented-characters-rendering-inconsistently-when-accessing-the-same-$c$c\">this 的问题,它似乎有一个文件保存在某个我们已经储存了错误的编码服务器上。

From the answers to this question it appears there's a file somewhere on our server that's been saved with the wrong encoding.

我已经看到这种情况发生前 - 经常从Word粘贴到Visual Studio中,当智能引号可以在保存文件时使用Visual Studio的编码设置干扰时

I've seen this happen before - most often when pasting from Word into Visual Studio, when "smart quotes" can interfere with Visual Studio's encoding settings when saving the file.

事情是 - 我有这个问题涉及到不同的20-30脚本文件,包括文件等(嘿,那是我们如何保持它模块化早在一天...),我真的不想打开他们每个人都在Visual Studio和独立检查文件进行编码。

Thing is - the problem I'm having involves 20-30 different script files, include files and so on (hey, that was how we kept it modular back in the day...) and I really don't want to open every one of them in Visual Studio and check the file encodings individually.

有什么办法我可以分析一个文件夹树满档吐出每个文件名的列表,用来保存文件的文本编码一起? (或者 - 如果没有明确规定的编码 - 找出什么编码微软IIS的认为的用于保存文件)

Is there any way I can analyze a folder tree full of files and spit out a list of each filename along with the text encoding used to save the file? (Or - if encodings aren't clearly specified - work out what encoding Microsoft IIS thinks was used to save the file?)

推荐答案

一个文本文件的编码是它只是打算如何成为跨preTED,所以你不能检测到这种以可靠的方式。你或许可以检测UTF-8和16位单code,但没有办法区分ISO-8859-1 / 2/3/4等...(的Windows-1250 /一千二百五十二分之一千二百五十一等)。

A textfile's encoding is just how it was intended to be interpreted, so you cannot detect this in a reliable way. You can probably detect UTF-8 and 16-bit unicode, but there's no way distinguishing between ISO-8859-1/2/3/4 etc... (Windows-1250/1251/1252 etc.).

如果您的文档包含怪异行情,除了或,你可以简单地找到这些,和手动替换它们。

If your document contains "weird" quotes, other than "" or '', you can simply find these, and replace them manually.

这篇关于如何确定在Windows / IIS文件编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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