Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output encoding issue of the Test Runner #632

Closed
sunnynie opened this issue Feb 28, 2019 · 6 comments
Closed

Output encoding issue of the Test Runner #632

sunnynie opened this issue Feb 28, 2019 · 6 comments
Labels
Milestone

Comments

@sunnynie
Copy link

Issue Type: Bug

Chinese is not supported,The output of English is acceptable.
@test
public void test(){
System.out.println("dd");
System.out.println("等待");
}

Extension version: 0.14.1
VS Code version: Code 1.31.1 (1b8e8302e405050205e69b59abb3559592bb9e60, 2019-02-12T02:20:54.427Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz (4 x 3592)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 7.87GB (2.02GB free)
Process Argv
Screen Reader no
VM 0%
@sunnynie
Copy link
Author

I hope it can be repaired as soon as possible. Thank you.

@yaohaizh
Copy link
Contributor

@sunnynie Which part of Chinese is not display? The output? What is the version of VSCode Java redhat extension?

@jdneo jdneo changed the title Chinese is not supported Encoding issue of the Test Runner Mar 11, 2019
@jdneo jdneo changed the title Encoding issue of the Test Runner Output encoding issue of the Test Runner Mar 11, 2019
@hebgaoyan
Copy link

me too,like #652
Language Support for Java(TM) by Red Hat redhat.java @0.40.0
Java Test Runner @0.15.0

@gculik
Copy link

gculik commented Mar 11, 2019

Same here, the Java Test Runner Output is not handling Unicode properly, while the standard Debug Console Output works fine.

    @Test
    public void testEncoding()
    {
        System.out.println("\u00B0C");
    }

outputs �C, whereas

    public static void main(String[] args)
    {
        System.out.println("\u00B0C");
    }

correctly outputs °C

@jdneo
Copy link
Member

jdneo commented Mar 14, 2019

@ALL, the root cause of this issue is that:

When the Java language server compiling the source file, the file encoding will set to utf-8 by default, or the user can customize the encoding with the setting files.encoding.

When running the test cases with the Test Runner, if the encoding setting is not equal with the files getting compiled, then those messy code will appear.

If you hasn't set the setting files.encoding, then that means the files are compiled with utf-8 encoding. You can simply add the following test configurations to correct the encoding as a workaround:

"java.test.config": {
    "vmargs": ["-Dfile.encoding=utf-8"]
}

I'll add some detecting logics later to better solve this problem.

@jdneo jdneo added this to the 0.16.0 milestone Mar 14, 2019
@jdneo
Copy link
Member

jdneo commented Mar 18, 2019

This issue should be fixed in #654 & #662 .

So we have several ways to set the file encoding when running tests:

  1. By default is utf-8.
  2. The encoding set in the setting files.encoding
  3. The encoding set in the test configuration. for example:
"java.test.config": {
    "vmargs": ["-Dfile.encoding=Cp1252"]
},

The higher ones will be overridden by the lower ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants