Coldfusion 不转换重音文本或 MS Word 字符 [英] Coldfusion not converting accented text or MS Word chars

查看:18
本文介绍了Coldfusion 不转换重音文本或 MS Word 字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 Coldfusion 8,我试图在保存到数据库之前清理文本输入,该数据库将采用 MS 等价物 '" - 和重音字母,并对其进行转换.

Running Coldfusion 8, I am trying to clean text input before saving to a database that will take things like the MS equivalent of ' " - and accented letters, and converting them.

我尝试过替换、REReplace 以及在 Internet 上找到的各种 UDF.似乎没有一个工作.事实上,我试过这个:

I have tried replace, REReplace, and various UDFs found on the internet. None seem to work. In fact, I tried this:

<cfscript>
    function cleanString(string) {
       var newString = string;
       newString = replace("'", "'", ALL);
       return newString; 
    }
</cfscript>

上面要替换的单引号是MS Word 风格的单引号.Coldfusion 抛出一个错误,错误范围表示无效语法,并且错误范围中的单引号是一个正方形.如果我将其更改为 chr() 形式,并替换为 ',我会得到一个空白.如果我对实体执行 chr(),我会得到一个空白.

The single quote to be replaced above is a MS Word style single quote. Coldfusion threw an error, the error scope said invalid syntax and the single quote in the error scope was a square. If I change it to the chr() form, and replace with ', I get a blank. If I do chr() to the entity, I get a blank.

我非常确定我之前已经跨越了这个障碍,但不知道为什么现在没有任何效果.CF8 和 CF7 中是否有关于我缺少的字符编码的新设置?

I am more than certain I have jumped this hurdle before, and not sure why nothing is working now. Is there a new setting in CF8 vs CF7 regarding character encoding that I am missing?

推荐答案

有一个很棒的脚本可以用来贬低从 MS word 等复制的文本(是的,这是一个技术术语).可以在 CFLib 中找到它:
http://cflib.org/index.cfm?event=page.udfbyid&udfid=725

There is a great script for demoronizing (yes, that's a technical term) text copied from MS word and the like. It can be found at CFLib:
http://cflib.org/index.cfm?event=page.udfbyid&udfid=725

我已经多次使用它,并且对它开箱即用感到满意(尽管我为特定应用添加了一些附加功能).

I've used it several times, and been happy with it out-of-the-box (though I have added some additions for specific applications).

这篇关于Coldfusion 不转换重音文本或 MS Word 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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