ColdFusion字符编码问题 [英] ColdFusion character encoding issue

查看:115
本文介绍了ColdFusion字符编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我开始说出我的最终目标(如果我在我的任何假设或字符编码的理解不正确):我希望我的网页的字符正确显示,即使我粘贴的唯一字符Word或其他程序。

Let me start out by saying my end goal (in case I'm incorrect in any of my assumptions or understanding of character encoding): I want the characters of my webpages to display correctly, even if I paste in unique characters from Word or other programs.

希望这可以工作大部分时间,而不必通过一些编码功能在服务器端。我总是与美国英语和粘贴从Word,所以它似乎不应该是那么困难。

Hopefully this can work most times without having to pass it through some encoding function on the server-side. I'm always working with US English and pasting from Word, so it doesn't seem like it should be that difficult.

在我看来,ColdFusion正在搞乱我的字符编码和显示撇号(可能从Word粘贴)为。我的页面作为一个.htm文件,但一旦我重命名扩展名为.cfm,它不。请参阅这里:

It seems to me that ColdFusion is messing up my character encoding and displaying apostrophe's (probably pasted from Word) as ’. My page works as a .htm file, but as soon as I rename extension to .cfm, it doesn't. See here:

  • http://www.viktorwithak.com/Temp/utf8.htm
  • http://www.viktorwithak.com/Temp/utf8.cfm

这是我看到的,万一你有什么不同:
http:// i。 imgur.com/tA4p1yc.png
(看起来像一个工作,说Content-Type是text / html,没有Content-Type:text / html; charset-UTF -8)

Here's what I'm seeing, in case you get anything different: http://i.imgur.com/tA4p1yc.png (Looks like the one that works says Content-Type is text/html, and the one that doesn't has Content-Type: text/html; charset-UTF-8)

建议? (我是否正确的UTF-8应该是正确的编码?)

Suggestions? (Am I correct that UTF-8 should be the correct encoding?)

编辑:为方便起见,我的两个文件的源:

for convenience, my source for both files:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>utf-8</title>
</head>
<body>
<p>Make sure you don’t pack your toiletries or clothes for your travel day.</p>
</body>
</html>


推荐答案

如果您使用的是CFBuilder2 +, BOM标记应该使所有UTF-8默认。然而,如果你不是,并且你的编辑没有设置BOM标记的设置,那么你需要使用它作为您的cfm的第一行。

What editor are you using? If you're using CFBuilder2+ the BOM mark should made everything UTF-8 by default. However if you're not, and your editor has no settings on setting BOM mark, then you'll need to use this as the first line of your cfm.

<cfprocessingdirective pageEncoding="utf-8">

这篇关于ColdFusion字符编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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