Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are certain characters not being injected correctly to SQL Server from a CFQUERY?

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

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

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

The column gets populated fine with 20m².

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

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

The column gets populated with: 20m²

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.

Thanks

like image 826
paddyc Avatar asked Oct 29 '25 11:10

paddyc


1 Answers

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

enter image description here

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.

enter image description here

like image 189
Jules Avatar answered Oct 31 '25 10:10

Jules



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!