Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with cfquery text encoding

I have an encoding problem 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 doing a cfdump on the query variable, the generated sql 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 that way. Is there any way to change the encoding of the cfquery tag?

I tried changing the encoding of the page with the cfcontent tag to no avail. I also tried to use SetLocale() without much result either.

Thanks.

like image 769
DJTomH Avatar asked Jan 12 '23 12:01

DJTomH


1 Answers

I found a solution.

<cfprocessingdirective pageEncoding="UTF-8" />

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

like image 89
DJTomH Avatar answered Jan 21 '23 11:01

DJTomH