FYI, the properties section is to avoid setting encoding individually in every plugin section: see [1] for more information.
Can you give more code? Because with the little snippet you gave us, nobody can tell you what is wrong: at this point in code, there is no bytes but only chars, then no encoding problems. I don't know exactly what you do to tell "Only Maven Console I have "file.encoding = Cp1252"", but if your code contains xml.getBytes(), I can tell you that it is the problem: transform it to xml.getBytes( "UTF-8" ) and everything will be ok. Note: this is not a Maven question at all but general language and encoding... Regards, Hervé Le jeudi 05 mars 2009, Lucas Eskopinski a écrit : > Hi, > > I tried this code but still did not work. > > Only Maven Console I have "file.encoding = Cp1252". > > Thanks. > > Kalle Korhonen-2 wrote: > > This *should* do it: > > <properties> > > > > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > > </properties> > > > > Kalle > > > > > > On Wed, Mar 4, 2009 at 5:55 PM, Lucas Eskopinski > > > > <[email protected]>wrote: > >> Hi, > >> > >> I have the following code: > >> > >> System.out.println("file.encoding=" + > >> System.getProperty("file.encoding")); > >> > >> StringBuilder xml = new StringBuilder(); > >> xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" > >> standalone=\"yes\"?>\n"); > >> xml.append(" sã[email protected]\n"); > >> > >> Junit result in the console is: "file.encoding=UTF-8", but when I run > >> Maven > >> > >> is the result: > >> >> mvn clean > >> >> mvn install -e > >> > >> [INFO] [resources:resources] > >> [INFO] Using encoding: 'UTF-8' to copy filtered resources. > >> [INFO] [compiler:compile] > >> [INFO] Compiling 115 source files to > >> D:\development\workspace-projects\projeto\target\classes > >> [INFO] [resources:testResources] > >> [INFO] Using encoding: 'UTF-8' to copy filtered resources. > >> [INFO] [compiler:testCompile] > >> [INFO] Compiling 20 source files to > >> D:\development\workspace-projects\projeto\target\test-classes > >> [INFO] [surefire:test] > >> [INFO] Surefire report directory: > >> D:\development\workspace-projects\projeto\target\surefire-reports > >> > >> ------------------------------------------------------- > >> T E S T S > >> ------------------------------------------------------- > >> ... > >> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.109 > >> sec Running br.teste.EmailTest > >> file.encoding=Cp1252 > >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< !!!!!!!! > >> javax.xml.bind.UnmarshalException > >> - with linked exception: > >> [com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceExcepti > >>on: Inva > >> lid byte 2 of 3-byte UTF-8 sequence.] > >> at > >> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.un > >> marshal0(UnmarshallerImpl.java:197) > >> at > >> com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.un > >> marshal(UnmarshallerImpl.java:168) > >> at > >> javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnm > >> arshallerImpl.java:137) > >> at > >> javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnm > >> arshallerImpl.java:184) > >> > >> my settings: > >> > >> > >> <plugin> > >> <artifactId>maven-compiler-plugin</artifactId> > >> <configuration> > >> <source>1.6</source> > >> <target>1.6</target> > >> <encoding>UTF-8</encoding> > >> </configuration> > >> </plugin> > >> <plugin> > >> <artifactId>maven-resources-plugin</artifactId> > >> <configuration> > >> <encoding>UTF-8</encoding> > >> </configuration> > >> </plugin> > >> <plugin> > >> <groupId>org.codehaus.mojo</groupId> > >> <artifactId>cobertura-maven-plugin</artifactId> > >> <version>2.2</version> > >> <configuration> > >> <encoding>UTF-8</encoding> > >> </configuration> > >> </plugin> > >> <plugin> > >> <groupId>org.apache.maven.plugins</groupId> > >> <artifactId>maven-surefire-report-plugin</artifactId> > >> <version>2.4.2</version> > >> <configuration> > >> <encoding>UTF-8</encoding> > >> </configuration> > >> </plugin> > >> > >> >> mvn -version > >> > >> Maven version: 2.0.9 > >> Java version: 1.6.0_06 > >> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" > >> > >> Can anybory help me? > >> > >> Thanks. > >> > >> Lucas. > >> -- > >> View this message in context: > >> http://www.nabble.com/XML-encoding-problems-with-Maven-tp22343793p223437 > >>93.html Sent from the Maven - Users mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
