Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Aaron N. / ()
Created: 02/17/2019
Components: File Management
Versions: 2016,2018
Failure Type: Non Functioning
Found In Build/Fixed In Build: 2018.0.0.310739 / CF2016U12,CF2018U5
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Windows 10 64 bit
Vote Count: 0
Issue: FileWrite() cannot change FileObject's charset
This works:
----
{code:java}
<cfprocessingdirective pageencoding="utf8"><!--- B/c CF-3712167 --->
<cfscript>
//cfprocessingdirective(pageencoding="utf8");//b/c auto-detection of page encoding randomly fails
fileWrite(expandPath("./myfile1.txt"), "a", "us-ascii");
fileWrite(expandPath("./myfile1.txt"), "€", "utf-8");//myfile1.txt becomes UTF8 (good)
</cfscript>
{code}
----
This fails:
----
{code:java}
<cfprocessingdirective pageencoding="utf8"><!--- B/c CF-3712167 --->
<cfscript>
//cfprocessingdirective(pageencoding="utf8");//b/c auto-detection of page encoding randomly fails
fileWrite(expandPath("./myfile2.txt"), "a", "us-ascii");
myFileObject = fileOpen(expandPath("./myfile2.txt"), "write", "us-ascii");
fileWrite(myFileObject, "€", "utf-8");//throws "Complex object types cannot be converted to simple values."
fileClose(myFileObject);
</cfscript>
{code}
----
Suggestion: Allow `charset` parameter, when FileWrite() writes to myFileObject.
Attachments:
Comments: