Copy link to clipboard
Copied
I moved code from ColdFusion2016 (Linux) to ColdFusion2023 (Windows). The database and network share behind the website are identical.
I am using cffile read to read a file in a network share. The website on the CF16 server can read the file and displays as expected. The website (same code) on the CF23 server is unable to read the file and throws and error.
This is the value in our database that sits behind both CF16 & CF23 code 'PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You — Triggered Email.htm'
On the network drive the filename is displayed as 'PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You â” Triggered Email.htm'
I do not have any control over the filenames that are placed into the network share.
I can see that the em-dash is translated into â” in the file. I'm at a loss as to why cffile on CF16 reads the file but cffile on CF23 an error is thrown. I would expect the same result either they both read the file or they both throw and error. I assume that there was some change to CF or cffile that will cause this behavior but I cannot seem to find out what. I looked at the documentation and didn't find a clue. I also looked at the CF Administrator trying to see there is anything in there that need to be added/changed/checked.
ERROR MESSAGE
An error occurred when performing a file operation read on file //hoover/sim_client/invite_uploads/PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You — Triggered Email.htm.
The cause of this exception was: java.io.FileNotFoundException: //hoover/sim_client/invite_uploads/PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You — Triggered Email.htm (The system cannot find the file specified).
The error occurred in //nagennas02/ColdFusion2023/mdocfprod/invites-app/invites/showinvite.cfm: line 42
40 :
41 : <cffile action = "read"
42 : file = "\\hoover\sim_client\invite_uploads\#getInviteData.ServerAttFile1#"
43 : variable = "inviteFile" >
44 : <p>
Has anyone else had an issue like this?
TIA,
Jennifer
Copy link to clipboard
Copied
I don't see any — character in ColdFusion's error message. I am therefore confused as to why you think it is a CF2016 versus CF2023 question. After all, you say, "On the network drive the filename is displayed as 'PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You — Triggered Email.htm' ". If my address in the US contains the characters मेरा पता then I won't blame the postman for being unable to deliver my letters.
Or perhaps there's something I'm missing from your explanation. What do you mean by "On the network drive the filename is displayed as"?
Copy link to clipboard
Copied
In the meantime, some things you could try:
<cfset path='PLN_29886_ Istanbul SIOT DAY 1 - 1to1 Turkish Thank You — Triggered Email.htm'>
<cfset convertedPath=ReplaceNoCase(path, '—', chr(8212))>
<cfoutput>#convertedPath#</cfoutput>