After I modify Connectorservlet.java and Simpleuploaderservlet.java two files, regenerate Fckeditor-java-2.3.jar package, to solve all the garbled problem, there are 3 to modify
1. Modify the character encoding of the Web container, if the Web container is Tomcat, modify the Conf/server.xml file, add "uriencoding=" Utf-8 "" in two connector, I use the Utf-8 code here, So modify to Utf-8, if the item is GB2312 encoded, then set to "uriencoding=" gb2312 "".
2. When uploading files in the Browse Server page, open the file in Project Webroot/editor/filemanager/browser/default/frmupload.html and add a meta to the head: To see if the file is Utf-8 format, if not, then convert to Utf-8, if you do not use the Utf-8 will be converted to the kind of code you use, above CharSet also set to your code
3. Modify Connectorservlet.java and Simpleuploaderservlet.java two files, I added a static variable to all two files encoding,private static String Encoding Save the code in the project, if the variable is not given a value in the Web.xml file, the default is gb2312, the following code if (Encoding.isempty ()) {encoding= "gb2312";}, Add request.setcharacterencoding (encoding) to the beginning of the doget and Dopost of Connectorservlet.java and set the requested character set encoding to the encoding in the project. Diskfileupload upload = new Diskfileupload () in Connectorservlet.java and Simpleuploaderservlet.java two files; Add upload.setheaderencoding (encoding) to the back, and tell the FileUpload component that the code for the process is encoded for the project, in Fileitem, with GetString (encoding), This setting resolves the problem of getting a form field to be garbled, so after each Fileitem instance executes a getstring (encoding), telling Fileitem that the encoding to use for the value is the encoding that is set by encoding. In the case of the Fileitem item in Connectorservlet.java and Simpleuploaderservlet.java two files, add a sentence item.getstring (encoding); in Fileitem Uplfile followed by a sentence of uplfile.getstring (encoding); The next step is to set the Web.xml, in the Web.xml to the above mentioned encoding pass the value, as follows
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
Everything OK, the real resolution of the upload of Chinese name pictures garbled problem.
In the 3rd step above, to use ant to generate the jar, note that the Catalina-ant.jar in the/server/lib under the Tomcat installation directory is copied to the/web-inf/lib under the project. Open Build.xml and modify the property name= "Catalina.home" into Tomcat's installation directory. Modify Taskdef name= "Deploy", Taskdef name= "list", Taskdef name= "Reload", Taskdef name= "Undeploy" as follows:
<taskdef name= "Deploy" classname= "Org.apache.catalina.ant.DeployTask" >
<classpath refid= "Compile.classpath" ></classpath>
</taskdef>
<taskdef name= "list" classname= "Org.apache.catalina.ant.ListTask" >
<classpath refid= "Compile.classpath" ></classpath>
</taskdef>
<taskdef name= "Reload" classname= "Org.apache.catalina.ant.ReloadTask" >
<classpath refid= "Compile.classpath" ></classpath>
</taskdef>
<taskdef name= "Undeploy" classname= "Org.apache.catalina.ant.UndeployTask" >
<classpath refid= "Compile.classpath" ></classpath>
</taskdef>
Then you run Ant's Dist in the Eclipse's Outline window, and the new Fckeditor-2.3.jar is generated. Is absolutely true, sharing out and share with you, less one upload other files, such as RAR, have added this function of friends also take out share under it
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.