Visual Web Developer 2008 Express 中的源编码

发布于 2024-07-08 21:03:24 字数 138 浏览 8 评论 0原文

我可以在哪里设置? 我需要默认将文件编码为 UTF-8...工具 -> 中没有任何内容 据我所知,选项或任何其他菜单:(

PS 我不需要为 Project 等设置默认编码,我需要将它设置为我创建的任何文件的默认编码。感谢您的帮助:)

Where can I set it? I need files to be encoded in UTF-8 by default... there is nothing in Tools -> Options or any other menu as far as I know :(

P.S. I don't need to set default encoding for Project or so, I need it to be default for any files I create. Thanks for your help :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

零崎曲识 2024-07-15 21:03:24

不要单击“保存”,而是单击“另存为”。 然后单击“保存”旁边的小向下箭头以使用编码保存。 完成此操作后,您将看到完整 VS studio 中出现的高级保存选项。 然后您可以选择 UTF-8 作为编码。

Instead of clicking save click save as. Then click the little down arrow by save to save with encoding. Once this is done it will bring you to the advanced save options which appear in full VS studio. You can then pick UTF-8 as the encoding.

残花月 2024-07-15 21:03:24

当您选择另存为时,编码选项可从附加到“保存”按钮的下拉列表中找到。

The encoding options are available from a drop down list attached to the Save button when you select Save as..

奢望 2024-07-15 21:03:24

文件-> 高级保存选项

选择编码和行结尾

问候,
哈里斯

File -> Advanced save options

Choose Encoding and Line endings

Regards,
Haris

小忆控 2024-07-15 21:03:24

我相信您不能将源编码设置为项目设置。 相反,它尝试使用相当有限的算法来确定文件的源编码。 该算法的一部分是

  • 如果它具有 UTF-8 签名 (BOM),则它是 UTF-8 编码的,
  • 否则,它位于 ANSI 系统代码页 (CP_ACP)

之间可能有一些额外的检查(例如检查 UTF -16 也带有 BOM)。

根据我的经验,“另存为”编码不是很有用,除非另存为 UTF-8-with-BOM。 您可以将其保存为不同的编码,但在重新打开时,它仍然会假定它是 CP_ACP。

I believe you cannot set the source encoding as a project setting. Instead, it tries to determine the source encoding from the file, using a fairly limited algorithm. Part of that algorithm is

  • if it has an UTF-8 signature (BOM), it is UTF-8 encoded
  • otherwise, it is in the ANSI system code page (CP_ACP)

There might be some additional checks in-between (e.g. checking for UTF-16 with BOM also).

In my experience, the "save as" encoding is not very useful, unless saving as UTF-8-with-BOM. You can save it in a different encoding, but in reopening, it will still assume it's CP_ACP.

夜吻♂芭芘 2024-07-15 21:03:24

IIRC,Visual Studio中的源文件已经编码为UTF-8。

但是,如果我错了或者您只是想强制执行任何特定编码,您可以通过选择文件的“另存为...”选项并检查“保存”下的下拉选项来完成此操作按钮从那里。

IIRC, source files in visual studio are already encoded as UTF-8.

However, if I'm wrong or if you just want to force any specific coding, you can do it by choosing the Save As... option for the file and checking the pull down options under the save button from there.

鹿! 2024-07-15 21:03:24

感谢您的回答,但这并不完全是我所需要的。

好的,我会尝试更具体。 事情是这样的:我转到打开网站,我直接通过 FTP 打开网站。 在右侧我可以看到文件列表。 我右键单击它,选择新项目,html 文件,我有新的 html 文件。 我向其中添加一些文本,单击“保存”(CTRL+S),文件即被保存。 现在我通过浏览器打开它,发现它不是以 UTF-8 格式保存的。 那么,我可以通过任何方式解决这个问题吗? :)

Thank you for your answers but that's not exactly what I need.

Ok I will try to be more specific. That's how it goes: I go to Open website, I open website directly via FTP. On the right hand side I can see file list. I right-click on it, choose new item, html file, I have new html file. I add some text into it, click save (CTRL+S), the file is saved. Now I open it via browser and I see it's not saved in UTF-8. So, can I fix this problem in any way? :)

蓝戈者 2024-07-15 21:03:24

您是说即使源文件以 utf-8 编码,您的互联网浏览器仍将其显示为 ansi? 你定义了元编码标签吗?

http://tlt.its.psu.edu/suggestions/ International/web/tips/declare.html

尝试一下,您的浏览器应该显示它是 utf-8。 仅以 utf-8 格式保存文件是不行的。

are you saying that even though the source file is encoded in utf-8, your internet browser is displaying it as ansi? do you have a meta encoding tag defined?

http://tlt.its.psu.edu/suggestions/international/web/tips/declare.html

try this and your browser should say it is utf-8. just saving a file in utf-8 won't do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文