Skip to main content
Inspiring
March 25, 2009
Question

cffile and UTF-8

  • March 25, 2009
  • 16 replies
  • 4720 views
Hello Community!

I have a program that uploads a file to a remote FTP server. I am using cffile to write the file there and it MUST be uploaded in UTF-8 format. Despite that, the file is being uploaded as ascii or ansi, anything except UTF-8.

This is my line of code:
<cffile action="write" file="#f_dir##f_name#" output="#dataHeader#" charset="utf-8">

charset="utf-8" is not working for me.

Does anybody else have the same problem? Any thoughts?

Thanks!

Ysais.
This topic has been closed for replies.

16 replies

Inspiring
March 26, 2009
Paul,

So I could set the trasnferMode attribute to "BINARY"?

Thanks!

Ysais.
Inspiring
March 26, 2009
Additional Information

Two of my original files are showing up as ANSI. One of them as UTF-8. The funny thing is that the encoding looks different to me in notepad ++ and Editplus. In the first one the encoding shows as ANSI, but in the latter the encoding shows as UTF-8.

I took some steps further and went to cf_root/lib/neo-runtime.xml and made sure that the default character encoding was set to UTF-8. The more I dig into this the less answers that are popping up in my head. The issue persists :-)

Thanks!

Ysais. Text
Inspiring
March 26, 2009
Adam, Paul and Mack thank you for your responses.

I will review my file and your observations and I will post in here how it went.

Thanks!
Inspiring
March 26, 2009
apocalipsis19 wrote:
> Does anybody else have the same problem? Any thoughts?

first check that the original file is actually encoded as utf-8.
Inspiring
March 26, 2009
> charset="utf-8" is not working for me.

What version of CF? There was a problem with <cffile> and the charset
attribute back in CFMX6.1... 7.x... I forget which.

This could potentially be your problem.

--
Adam
Inspiring
March 26, 2009
Adam,

I am using CF8.

I double checked and every where in my code where I create or append to the file I make sure that my charset is set to utf-8.

In the cfftp there's a trasnferMode attibute but it can only be set to "ASCII", "ANSI" or "AUTO."

Any more thoughts gentlemen?

Thanks!

Ysais.
Inspiring
March 25, 2009
apocalipsis19 wrote:
> Hello Community!
>
> I have a program that uploads a file to a remote FTP server. I am using cffile
> to write the file there and it MUST be uploaded in UTF-8 format. Despite that,
> the file is being uploaded as ascii or ansi, anything except UTF-8.

CFFILE is independent from CFFTP (I'm assuming you're using CFFTP to
upload to the remote server). I think you're searching for the
transferMode attribute of the CFFTP tag.

--
Mack