How to change the file encoding from a specific JSP file from Netbeans 6.1?!
Ok. I don' know!
You try edit the JSP file, change from a encoding to other, close the file and open it again to see if the Netbeans recognizes the change, but sometimes, it fails! I think it's Netbeans bug...
<?xml version="1.0" encoding="ISO-8859-1"?> <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf"> <jsp:directive.page contentType="text/html;charset=ISO-8859-1" pageEncoding="ISO-8859-1"/>
Unfortunately, sometimes, this doesn't works and I don't know the reason... you can try to open the file using an text editor and saving it using another charset, or use some kind of file utility to convert it, but Netbeans yet doesn't recognize the new charset/encoding... Why? Netbeans saves some file attributes into ~/.netbeans/6.1/var/attributes.xml
(I'm using Linux, but there is an equivalent file in other OSs, too). So, you must close the Netbeans IDE, open the attributes.xml
using some editor, find the correspondent JSP filename entry and change the char set/encoding schema and you can open the Netbeans IDE again and to our surprise the Netbeans, finally, recognize the encoding change. Don't forgot to change charset/encoding from the JSP file, also. Bellow is an entry from the attributes.xml
with the charset attribute to be changed:
<fileobject name="|home|usuario|dev|projects|eletron|rastreador|TrilhaWeb|web|monitor|IndexX.jsp">
<attr name="encoding" stringvalue="ISO-8859-1"/>
<attr name="jsfjsp" boolvalue="true"/>
</fileobject>
Good luck!
1 Comments:
In the Windows, the attributes.xml is located in C:\Documents and settings\"user"\.netbeans\"version"\var. But I can't see in the attributes.xml the file that I'm trying change the encoding. The date of this file is not changed after I edit and save a file in NetBeans.
Post a Comment
<< Home