问题
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
回答1:
If it's hard coded, I believe you'll want to make sure you save that file in Unicode 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.
来源:https://stackoverflow.com/questions/39709490/why-are-certain-characters-not-being-injected-correctly-to-sql-server-from-a-cfq