You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gili (JIRA)" <ji...@apache.org> on 2016/01/28 10:56:39 UTC

[jira] [Created] (SUREFIRE-1220) Surefire never outputs UTF-8 under Windows

Gili created SUREFIRE-1220:
------------------------------

             Summary: Surefire never outputs UTF-8 under Windows
                 Key: SUREFIRE-1220
                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1220
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Surefire Plugin
    Affects Versions: 2.19.1
         Environment: Windows 10, 64-bit
DejaVu Sans font
            Reporter: Gili


I'm having problems getting Surefire to output UTF-8 fonts under Windows.

When I run a unit test that outputs a Guava Range ("10‥20") the TWO DOT LEADER unicode character always gets rendered as a question mark.

If I run the exact same code outside of Surefire (using a main() entry point) the UTF-8 character renders just fine. The repro steps are quite simple:

# Create a Maven project.
# Run {code}System.out.println(Range.closed(10, 30));{code} in a Java class with a main() entry point, and from a JUnit test.
# The main() entry point will output UTF-8 just fine. The JUnit test will output a question mark in place of the unicode.

Here is my pom.xml file:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>mavenproject1</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>foo.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>
{code}

I tried the same thing using TestNG tests and noticed that although output to console was still wrong, the outputted testng-results.xml file contained the correct character.

Can you reproduce this on your end?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)