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

查看:110
本文介绍了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.

我非常确定自己之前已经跳过了这一障碍,确定为什么现在什么都不起作用。

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?

推荐答案

在CF8和CF7中是否存在关于我缺少的字符编码的新设置?是的,这是一个技术术语)从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天全站免登陆