为什么某些字符无法从CFQUERY正确地注入SQL Server? [英] Why are certain characters not being injected correctly to SQL Server from a CFQUERY?

查看:126
本文介绍了为什么某些字符无法从CFQUERY正确地注入SQL Server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Lucee上运行的Coldfusion应用程序,该应用程序连接到SQL Server数据库.

I have a Coldfusion app running on Lucee which connects to a SQL Server database.

当我直接在SQL Server管理器中运行以下查询时:

When I run the following query directly in SQL Server Manager:

UPDATE article
SET content='20m²'
WHERE id=3159

该列的填充面积为20平方米.

The column gets populated fine with 20m².

但是,从仅运行此命令的cfml页运行时

HOWEVER, when run from a cfml page which simply runs this:

更新文章 SET content ='20m²' 在哪里id = 3159

UPDATE article SET content='20m²' WHERE id=3159

该列填充为:20m²

在这种情况下,将出现这个附加的Â字符.其他一些特殊字符也会发生这种情况,但大多数情况都很好.这与jdbc连接器的某些配置有关吗?我看不出上述两者之间应该有什么区别?将值放在cfqueryparam标记中没有区别.

As in, this additional  character appears. This also occurs with some other special characters, but most are fine. Is this to do with some configuration of the jdbc connector? I don't see what the difference should be between the above two? Putting the value in a cfqueryparam tag makes no difference.

谢谢

推荐答案

如果是硬编码的,我相信您需要确保将文件保存为Unicode UTF-8.

If it's hard coded, I believe you'll want to make sure you save that file in Unicode UTF-8.

还要确保您的JVM参数也将对其进行处理. 管理>服务器设置> Java和JVM. 在参数中添加"-Dfile.encoding = UTF-8".

Also make sure your JVM arguments will process that as well. Admin > Server Settings > Java and JVM. Add " -Dfile.encoding=UTF-8" to the Arguments.

这篇关于为什么某些字符无法从CFQUERY正确地注入SQL Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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