Re: [enhydra] Problem with UTF-8 on EE-6.5-1
Daniel Guryca <[email protected]> Wed, 28 Sep 2005 23:27:12 +0200
| Newsgroups | gmane.comp.java.enhydra.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1127950436-30191-145 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Michael Strapp wrote: > Hi Daniel, > Is it possible that the encoding being used by javac to compile > your Example.java file is not selecting the proper character > encoding? From the command line, selecting the character encoding is > accomplished by passing the -encoding parameter to javac, from the Ant > build file (build.xml), this is accomplished by setting the encoding > attribute on the <javac> tag. > If you're using Eclipse as your IDE, you may run into some > additional problems here (we did) - you actually have to right-click > on the .java file and select Properties, and change the 'Text File > Encoding' setting to UTF-8. If you use the default text encoding (on > Windows that is, I'm not sure about Linux or other platforms), Eclipse > won't save any Unicode characters that you type or past into the file > (it replaces them with question marks). But this causes something of > a Catch-22 - Eclipse saves the file with the proper encoding, but also > places a byte-order mark (the BOM, Unicode character FEFF hex) at the > beginning of the .java file, which javac chokes on. In this case, in > order to use Eclipse as the IDE, but still be able to build using the > regular Enhydra build scripts (and the version of Ant that comes with > Enhydra), you end up having to escape any/all Unicode characters > within strings in the .java file (i.e. \ddd or \udddd), which means > you don't end up needing to save the .java file in UTF-8. We might > have been able to get around Eclipse's issues by configuring the full > build process within Eclipse using Enhydra's version of Ant (since > Eclipse is able to compile the file with the BOM intact), but we > didn't try it (we opted for using escaped character sequences in the > couple places we needed it) so I can't say for sure whether that would > work. > > Hope that helps... > Mike. > > ----- Original Message ----- From: "Daniel Guryca" > <[email protected]> > To: <[email protected]> > Sent: Tuesday, September 27, 2005 3:18 PM > Subject: [enhydra] Problem with UTF-8 on EE-6.5-1 > > >> Hi. >> >> I have a real problem with UTF-8 encoding in Enhydra Enterprise. >> >> I have set everything like this: >> >> 1) Change the HTML file to have this line: >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> >> >> 2) Add this line into xmlc file: >> -html:encoding utf-8 >> >> 3) Add this line into presentation.conf: >> Application.Encoding = "utf-8" >> >> 4) Add this to server.xml -> URIEncoding="utf-8" >> ... >> <Connector port="9000" >> maxThreads="150" minSpareThreads="25" maxSpareThreads="75" >> enableLookups="false" redirectPort="9043" acceptCount="100" >> debug="0" connectionTimeout="20000" URIEncoding="utf-8" >> disableUploadTimeout="true" /> >> >> But I am still not able to get proper characters from my page request. >> Everything defined in html files (include utf-8 characters) is printed >> properly but if I want to do this from my Example.java: >> >> ExampleHTML page = >> (ExampleHTML)myComms.xmlcFactory.create(ExampleHTML.class); >> page.getElementTest().getFirstChild().setNodeValue("Czech characters ... >> in utf-8"); >> >> Final output printed for my page request are bad messed encoded >> characters! >> But all utf-8 characters (untouched by java - set statically in HTML >> file) are printed properly. >> >> Java 1.4.2-09 + EE6.5-1 + Tomcat + Eclipse 3.0.0 (included with EE) >> running all these on standard Debian Sarge 3.1 with ISO8859-2 locales. >> >> Thank you for your advices. >> >> > > > -------------------------------------------------------------------------------- > > > >> >> -- >> You receive this message as a subscriber of the [email protected] >> mailing list. >> To unsubscribe: mailto:[email protected] >> For general help: mailto:[email protected]?subject=help >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws >> > > >------------------------------------------------------------------------ > > >-- >You receive this message as a subscriber of the [email protected] mailing list. >To unsubscribe: mailto:[email protected] >For general help: mailto:[email protected]?subject=help >ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > Thanks for your very detailed reply. I have tested to set encoding attribute within javac tag in build.xml file and it really works. The second problem - which you have discovered (\ddd or \udddd) seems to be only Windows related. In linux I have a default encoding set on UTF-8 (if I set it in global eclipse preferences) and there are not any byte-order marks appended. Thank you very much. ------------=_1127950436-30191-145 Content-Type: text/plain; name="message-footer.txt" Content-Disposition: inline; filename="message-footer.txt" Content-Transfer-Encoding: 8bit -- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws ------------=_1127950436-30191-145--