I'm using the code in this example example and in the runUpdate() function which i put in a javabean in a web application in Netbeans 6.8 with Glassfish v3.
It seems i have an encoding problem because question marks appear in the table.
I have tried so far:
In nbproject->private->private.properties add runtime.encoding=UTF-8>
In project->properties->sources->encoding utf-8
In program files->netbeans->etc->netbeans_conf in netbeans_default_options i add -J-DFile.encoding=UTF-8
In project->properties->build->compiling->additional compiler options -encoding utf-8
In sun-web.xml i added <locale-charset-info default-locale="UTF-8">
<locale-charset-map locale="" charset=""/>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
Also when i use system.out.print() in the glassfish output panel i get gibberish.
I'm in the last level of madness please take a look.
Thank you.
EDIT
Also when i do listing .5 i get a glassfish error:
WARNING: WEB0500: default-locale attribute of locale-charset-info element is being ignored
Have you tried using glassfish-web.xml instead of sun-web.xml ?
To change default Glassfish POST fields encoding, I put this to WEB-INF/glassfish-web.xml, and it worked (I use glassfish 3.1.2):
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
I'm not sure if it will help you, but may help other people having the same problem as me.
Glassfish uses ISO-8859-1 encoding by default. See http://download.oracle.com/docs/cd/E19798-01/821-1752/beafu/index.html for more information.
Are you sure your browser is set to UTF-8. By default most browsers do not display in UTF.
Start with the browser and work backwards. Is your datasource storing the data in UTF-8? By default Java is in UTF-8 so I am not sure that GF is your real issue.
Related
I am writing an Eclipse Plugin. All my source files are encoded as UTF8 (Alt+Enter shows "Text file encoding: UTF8").
When I run my plugin using "right click -> Run as eclipse application" everything works fine.
However, when I install my plugin using an update site in another (but identical, i.e., copied) Eclipse application, German Umlauts (Ä Ö Ü...) get messed up in all SWT-controls, but not in String constants.
Example:
public class MyWizard extends Wizard{
public NewEntityWizard() {
super();
setWindowTitle("This will NOT work: Ä");
}
public void foo() {
String contents = "This WILL work: Ä";
ByteArrayInputStream stream = new ByteArrayInputStream(contents.getBytes());
// write stream to file test.txt
}
The window title will show up as: "This will NOT work: ä"
When opening the file test.txt in Eclipse, with UTF8 encoding, it will contain the correct test: "This WILL work: Ä"
Both will work when run by using Run as, i.e., when not installing the plugin.
How do I resolve this?
I figure, the compiled plugin / bin files might (correctly) be encoded in UTF8, but read in a different encoding by the second Eclipse installation. If so: How do I tell the JVM / Eclipse to read the Plugin's bin files in UTF8?
Any help is appreciated.
Solved the problem myself. The issue was a Bug in Eclipse (I am running Oxygen, not sure if the problem exists in other versions).
The bug was, that the PDE Builder, which builds the product, does not respect the encoding settings configured in Eclipse. It uses the default encoding of the plattform, which is not UTF8. This seems to be a Windows only problem. The java builder does not suffer from this bug, that's why the problem did not occur during testing.
Bug Description:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=516656
Solution:
As workaround I added the following line to the eclipse.ini of the building Eclipse installation, build the product again and installed it again. The setting makes UTF-8 the default encoding for the whole VM.:
-Dfile.encoding=UTF-8
This solved the issue.
We ran into a migration issue where in we are migrating an application from JBoss 4.2.1.GA to JBoss EAP 7.0.0.GA. The exception encountered is as below.
java.lang.RuntimeException: java.nio.charset.IllegalCharsetNameException:
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:226)
So we have a fix for the same which involves
Adding the below in the struts config.xml file.
this line in config
<controller processorClass="org.apache.struts.chain.ComposableRequestProcessor"
locale="true" nocache="false" contentType="text/html; charset= UTF8">
<set-property property="maxFileSize" value="7M"/>
</controller>
has been changes to
tag from charset= UTF8 to charset= ISO-8859-1"
and an additional property
This has resolved the issue but wants to know what is the proper use of class ComposableRequestProcessor. And why it is helping our solution here.
We don't see a proper document or blog on the net explaining why and when we need to add this configration. What is the advantage of doing so?
Also, we want to know JBoss 4.2.1.GA the page-context encoding was not enforced but in JBoss EAP 7.0.0.GA we need to define it as ISO else it won't work in windows server environment.
We know it has to do with some Undertow implementation over the earlier Apache Tomcat HTTPs implementation framework used by JBoss.
Any help by pointing to right document or information is widely appreciated.
I just deployed my Tapestry 5 app on Jetty 9 web server, running on Debian Squeeze. I have problem with encoding. I can't see Serbian letters (šđčćž). For example, I see "Dobrodošli" as "Dobrodo??li". You can check it out HERE. As I know, Tapestry by default works with UTF8, on Debian locale is set SR Latin UTF8, and on Jetty I can't find any config setting where I could set it. I did the same thing local on my PC (Ubuntu 12.10), and everything works great.
Can you help me please? How to solve this problem, I don't know what I did wrong?
Thanks in advance.
Did you try setting value for tapestry.charset.
The character encoding used when generating output (or parsing input).
The default is "UTF-8".
For details checkout http://tapestry.apache.org/configuration.html
We have an Jenkins CI, which creates our Eclipse RCP application. It was set up with this tutorial: http://www.ralfebert.de/blog/eclipsercp/rcp_builds/ . So far so good, we didn´t have any problems until we decided to use utf-8 encoding for our project instead of the default cp1252 encoding. So the problem is if we start the created application that the encoding is damaged. I tried everything especially with jvm -dfile.encoding="utf-8" arguments. I tried this in rcp.target, jenkins arguments and build.xml build properties.
Have someone any idea how i can fix my problem?
thanks for every response
We have the same issue as well, unfortunately unsolved so far. I think the charset must be set in time of compilation. So this may be a jvm argument instead of program argument.
Make sure you have saved the encoding information in the project. If there is no such information, the eclipse instance default encoding will be used, which in turns defaults to the platform's default encoding.
Buckminster build uses the eclipse build which honors the resource meta data.
An anti pattern is to change the default in Eclipse, and not save it in projects. The next user with a different default then risks creating a complete mess, especially if they also change the default and save.
I deploy a war to my Tomcat 6.0.35 on Win7 64bit and when I use full-interface query page (I mean form.jsp) in Solr Admin to query 2 Chinese character (say it's C1C2) , the debug info shows:
<lst name="debug">
<str name="rawquerystring">æ°è</str>
<str name="querystring">æ°è</str>
<str name="parsedquery">NEWSID:æ°è</str>
<str name="parsedquery_toString">NEWSID:æ°è</str>
...
You can see C1C2 becomes æ°è. I deploy same war file to Tomcat on Linux or on another Win7 64bit of my colleagues' computer, the encoding acts well. Does anyone know why and how can I avoid this problem?
Thanks in advance!
I solved the problem. The evil is Win7's File Virtualization feature. By default, Win7 will enable this feature on several well-known folders, e.g. Windows, Program Files, ProgramData, etc. The effect is that under some conditions, a file will have dual contents and this just happen to occur on my server.xml.
The workaround is clean things in 'c:\Users\<user account>\AppData\local\VirtualStore'. The long-time solution is "Don't install Tomcat in these well-know folders. If you insist, be sure not to install-'n-uninstall too many times."
~~~ How I find this problem (you may not need to see this) ~~~
Two words: "Pure luck". When I use some xml editor to edit tomcat-users.xml and add a user 'test'. I restart Tomcat but can't login to use manager UI. I recheck tomcat-users.xml and see that user is indeed set. Even I uninstall-'n-install different version of Tomcat, login still fails.
Then I use notepad to edit tomcat-users.xml and I'm astonished to see it's the original version Tomcat has installed. After editing it with notepad and restart Tomcat, I can login now.
Very quickly, my thoughts flashes to server.xml and I use notepad to see it. Ah Ha! There's no URIEncoding attrbutes in connector tag. After fixing it, The problem is solved.
Eiplog
In my case, my xml editor and IE both show wrong version, but my other browers and notepad show correct version. I still don't know what algorithm does Win7 uses on File Virtualization, so I think workaround will live for a while.