S...">

Problem with cfquery encoding

I have an encoding issue with the cfquery tag.

This is my code:

<cfquery name="query" datasource="example">
    SELECT *
    FROM EXAMPLE_TABLE
    WHERE EXAMPLE_COLUMN = 'WORD WITH ACCENT É'
</cfquery>

When executing cfdump in the query variable, the sql generated by the cfquery tag changes the text to "WORD WITH ACCENT Ã ‰", but I need it to be É because the value in the table is set this way. Is there a way to change the cfquery tag encoding?

I tried to change the page encoding with the cfcontent tag to no avail. I also tried using SetLocale () without much result.

Thanks.

+4
source share
2 answers

I have found a solution.

<cfprocessingdirective pageEncoding="UTF-8" />

Added this to the top of the page and works like a charm.

+9
source

This is a formatted comment.

<cfquery name="x" datasource="dw">
select count(*) records
from event
where event_code = 'WORD WITH ACCENT É'
</cfquery>
<cfdump var="#x#" metainfo="yes">

Metainfo sql :

count (*) , event_code = 'WORD WITH ACCENT É'

ColdFusion 9.1, redbrick. sql .

0

All Articles