CFdirectory with Coldfusion 11, issue with non ascii characters in filenames

1.1k views Asked by At

I have a similar question to this: ColdFusion, CFDirectory and the French which was not given a satisfactory answer.

We have upgraded from Coldfusion 9 to Coldfusion 11. So far no major problems except the following:

When using CFdirectory to display file names that contain non ASCII characters in their names (eg: accents, umlauts) we get to see the file name with replacement characters � instead of the correct UTF equivalent. For example a file named L’État, c’est moi.pdf is displayed as L�����tat, c���est moi.pdf.

We are confident that this is a Coldfusion issue as nothing has changed but the Coldfusion version. With Coldfusion 9 CFdirectory worked OK when listing the same accented filenames. Our OS is Redhat 7.0 and the file names are also displayed correctly on the terminal with the ls command. I have also created a quick PHP script to see if PHP can read correctly the directory with the "readdir" command and there no problems there either, filenames are rendered correctly.

So I believe this has to be a Coldfusion 11 issue. I have added the -Dfile.encoding=UTF-8 -Dencoding=UTF-8 parameters in the JVM settings from the Coldfusion administrator server interface but it made no difference.

Any suggestions on how to rectify this would be appreciated.

example of code used follows:

<cfdirectory
action="list"
directory="#ExpandPath( './' )#/pdfs"
listinfo="name"
name="qFile"
/>  
<cfdump
var="#qFile#"
label="All Files"
/>

This the output of the cfdump:

4

There are 4 answers

9
BuzzCloudAU On

Have you tried setting the cfprocessingdirective tag?

<cfprocessingdirective pageencoding="utf-8">

CF 11 WikiDocs

Also, In the Chrome Network Inspector, make sure the encoding is being returned correctly. Eg:

Content-Type:text/html; charset=UTF-8
1
Denis On

If your environment is Linux, you need to have a clean UTF-8 configuration.

Please have a look here.

I had the same problem, I just add into the file ~/.bashrc these lines:

export LC_ALL=en_US.UTF-8 
export LANG=en_US.UTF-8 
export LANGUAGE=en_US.UTF-8

After that, don't forget to restart your Coldfusion Server

sudo /opt/coldfusion11/cfusion/bin/coldfusion restart
0
DucaBgd On

I had the same problem this solved my bug
/.bashrc LC_ALL="de_DE.UTF-8" on linux and after change restart coldfusion application

2
Jules On

Please see: Why are certain characters not being injected correctly to SQL Server from a CFQUERY?

Make sure your file is saved with encoding 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.

enter image description here