[ http://issues.apache.org/jira/browse/BEEHIVE-1033?page=all ] Julie Zhuo closed BEEHIVE-1033: -------------------------------
Verified with rev372375. Setting encoding="SJIS" in the beehive-tools.xml get the page flow compiler corrected. > NetUI APT does not create UTF-8 encoded output in the generated XML documents > for other multibyte encoded source files. > ----------------------------------------------------------------------------------------------------------------------- > > Key: BEEHIVE-1033 > URL: http://issues.apache.org/jira/browse/BEEHIVE-1033 > Project: Beehive > Type: Bug > Components: NetUI > Versions: 1.0.1, V1 > Reporter: Carlin Rogers > Assignee: Julie Zhuo > Fix For: 1.0.1 > Attachments: j1033-test.zip > > The struts module config files and validator rules generated by NetUI APT are > XML files with the encoding attribute of the declaration set to "UTF-8" > (<?xml version="1.0" encoding="UTF-8"?>). However, if a different multibyte > encoding is used in the source files, NetUI APT does not create UTF-8 encoded > output in the generated XML documents. Instead, the encoding of the input > source file is used for the output, even though we set the declaration > attrbute as UTF-8. Then, when this XML file is parsed there will be errors > such as SAXParseException about an incorrect byte sequence for UTF-8. > The problem occurs with the difference in the file encoding of the input Java > file and the charset used by our APT processor to write out the struts config > file. We just delegate to APT to create the file and have it use the encoding > of the source file. We get a PrintWriter for the generated XML output by > calling com.sun.mirror.apt.Filer.createTextFile() with null as the charset > name. The null charset name tells APT to use the charset used to encode > source files when we wite the file. > For example, on a Japanese Windows box the JVM file.encoding property may be > SJIS. When a source file is edited and multybite characters are used for the > names of actions, the encoding is SJIS. The beehive ant task for compiling a > Controller file with annotations will use the JVM file.encoding of the system > (SJIS) and correctly compile the source file. However, during the annotation > processing, when we get the PrintWriter to output the generated XML, it will > also use SJIS, regardless of the fact that we write a declaration that says > the output file encoding is UTF-8. > Note, you can set the encoding of the APT process with an option. So, one > possible workaround is to write your Controller.java file using the UTF-8 > encoding (or use the native2ascii converter in the JDK). Then explicitly set > the encoding to UTF-8 for the APT processor (and javac) in our ant macrodef > for "build-pageflows". To try this out, please follow these steps... > - Before building your sample app, edit the beehive-tools.xml file in your > Beehive distribution. It's in the ant subdirectory of your beehive home. > apache-beehive-svn-snapshot/ant/beehive-tools.xml > - Add the encoding option to the call to the <apt> task in the <macrodef > name="build-pageflows">. The line to add should be encoding="UTF-8". In the > macrodef, the <apt> task should look like this... > <apt srcdir="@{srcdir}" > destdir="@{destdir}" > gendir="@{tempdir}" > classpathref="_pageflow.build.classpath" > sourcepathref="@{sourcepathref}" > srcExtensions="*.jpf,*.jpfs,*.app,*.jsfb,*.java" > encoding="UTF-8" > processorOptions="[EMAIL PROTECTED]" > debug="true"/> > - Now try to build your modified sample app. > The output for the struts config file will be in UTF-8 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
