-
Notifications
You must be signed in to change notification settings - Fork 7
Error encoding JS files with UTF-8 encoding #4
Copy link
Copy link
Open
Description
Hi, I am having problems when trying to minify JS files that contain UTF-8 using JSMin from your combine.jar.
I've created a standalone version of your compressJsWithJSMin() method rather than the whole combine.cfc.
As a simple test I have the string "This is a test Франция" which results in the output "This is a test $@0=F8O"
I've tried setting a Charset string on the output toString() method but it makes no difference.
I realise that this isn't strictly an issue with your combine package but I hope you can forgive me for asking for help here.
I have a simple standalone example that demonstrates the issue;
<cfcontent type="text/html; charset=utf-8" />
<cfprocessingdirective pageEncoding="utf-8"/>
<html>
<head>
<title>JSMin UTF-8 test</title>
</head>
<body>
<cftry>
<cfscript>
testString = "This is a test Франция";
joInput = createObject("java","java.io.StringReader").init(testString);
joOutput = createObject("java","java.io.ByteArrayOutputStream").init();
javaloader = createObject('component','components.javaloader.JavaLoader').init([application.settings.localdir & "components/jsmin/combine.jar"]);
jJSMin = javaloader.create("com.magnoliabox.jsmin.JSMin").init(joInput, joOutput);
jJSMin.jsmin();
</cfscript>
<cfoutput><pre>
TestString:"#testString#"
Native:"#joOutput.toString()#"
UTF-8:"#joOutput.toString("UTF-8")#"
ISO-8859-1:"#joOutput.toString("ISO-8859-1")#"
US-ASCII:"#joOutput.toString("US-ASCII")#"
</pre></cfoutput>
<cfset joInput.close() />
<cfset joOutput.close() />
<cfcatch>
<cfdump var="#cfcatch#" />
</cfcatch>
</cftry>
</body>
</html>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels