Problem CFfile transfer data from a file that has umlauts (in utf8) into the database which is set to utf8 and stores umlauts etc ok


#1

Do you know of solution to CFfile (CF10) transfer data from a file that has umlauts (in utf8) into the MySQL which is set to utf8 and stores umlauts etc ok. i.e. you can paste into the table Schönborn OK, but cfile puts in Sch?nborn I have been googling this issue but cannot find an example where they import a file into MySQL

The data is got from the file, converted to array and pushed to the db. and right after the data is got from the file its corrupted

<cffile 
  action="read" 
  file="#request.imageUploadPathFull#/Imports/#arguments.filename#" 
  variable="csvitemdata">

here the data is taken from this file

the page is in UTF-8


#2

is your problem with lucee or cf10?


#3

CF10. We planning to move to Lucee asap, but have other issue to address first. I have searched if anyone has had a solution to this issue but not found it, I am hoping that Lucee developers have more expertise than CF developers :slight_smile:

Why does Lucee CFfile work differently to CF10?


#4

Does it work differently on Lucee?

if you don’t providing a reproducible, reduced test case there isn’t much to go on


#5

OK

Well I am just trying to get a CSV file with German and Turkish characters into MySQL table which is set to utf-8 and can stores these characters using CFfile. I suspect if it works in Lucee it will work in CF, if not we just have wait until we move to Lucee.


#6

I’m 100% certain this works with CF10 too, it’s probably just something wrong with your code

did you try setting a cfprocessingdirective pageencoding?

https://cfdocs.org/cfprocessingdirective


#7

We fixed it by adding charset=“utf-8” at the end of the cffile code. Using meta tags at start of page made no difference. Sorry I thought our developer had already tried that.


#8

cool, can you post the actual snippet of code solution, for others who encounter the same problem?


#9

Sorry I thought I had done, but the < and > stop it showing
< cffile action=“read” file="#request.imageUploadPathFull#/Imports/#arguments.filename#" variable=“csvitemdata” charset=“utf-8”>

Initially we put < meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” / > on the page but this has no effect on cffile