ColdFusion XLS“导出”和字符编码 [英] ColdFusion XLS "Export" and Character Encoding

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

问题描述

我使用HTML表格将资料从网页「汇出」到Excel。该表在浏览器中看起来很好,但在Excel中,特殊字符(例如撇号,商标符号等)被不正确地编码。如果我在记事本中打开导出的文件并将其保存为ANSII编码,然后在Excel中打开它一切看起来再次。

I am "exporting" data from a page to Excel using an HTML table. The table looks fine in the browser but in Excel special characters such as apostrophes, trademark symbols, etc. are improperly encoded. If I open the exported file in notepad and save it as ANSII encoded then open it in Excel everything looks fine again.

我试图在ColdFusion中使用cfcontent,setencoding和cfpagedirective设置页面编码,但是没有运气。任何建议?

I tried setting the page encoding in ColdFusion using cfcontent, setencoding, and cfpagedirective with no luck so far. Any suggestions?

编辑:作为一个临时工作,错误的字符可以通过将导出的文件保存到磁盘,在记事本中打开,然后再保存。

As a temporary work around, the erroneous characters can be removed by saving the exported file to disk, opening it in Notepad, and then saving it again. Not exactly the best solution for the problem.

对于奇怪的字符:

®变成®

™变成â¢

'变成

推荐答案

这是一个与编程相关的问题吗?

Is this a programming-related question?

至少,你可以像程序员一样提供一些调试信息。忘记撇号,有几个不同的字符,你可以这么说;在Excel中什么应该是商标符号看起来像:你会得到0,1或2个字符显示吗?如果非零,显示什么字符?是否可以在公式中使用CODE()函数来告诉我们您看到的字符的内部代码?

At the very least, you could make like a programmer and supply some debug information. Forget apostrophe, there are a few different characters you could mean by that; what does a what should be a trademark symbol look like in Excel: do you get 0, 1, or 2 characters displayed? If non-zero, what character(s) is/are displayed? Is it possible for you to use the CODE() function in a formula to tell us the internal code for the character(s) that you see?

更新感谢您提供有关有趣的角色实际出现在屏幕上的信息。基于这一点,以及如何使用记事本解决它,看起来保存的页面已经编码为UTF-8,但是Excel显示它,好像它是编码在ANSI代码页,例如。 cp1252在使用西欧语言的地方。

Update Thanks for the info about what funny characters actually appear on the screen. Based on that, and on how you managed to workaround it with Notepad, it appears that the saved page has been encoded in UTF-8, but Excel is displaying it as though it were encoded in the "ANSI" code page, e.g. cp1252 in places using a Western European language.

下一个问题:如何创建HTML表?在HTML的开始附近,应该有 charset = UTF-8 - 你看到了什么?是否已使用.htm,.html或其他扩展名保存HTML文件?如何将它导入到Excel?其中Excel:2007,2003,其他?

Next questions: how are you creating the HTML table? Up near the start of the HTML there should be something like charset=UTF-8 -- what do you see? Has the HTML file been saved with an extension of .htm, .html, or something else? How are you importing it into Excel? Which Excel: 2007, 2003, other?

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

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