Skip to content

Problem with Text file encoding UTF-8 in console

Summary

When writing in the console window using UTF-8 encoding, Portuguese accented characters are not displayed correctly.

Steps to reproduce

Create a Java project and set the text file encoding to UTF-8. Then run the code below.

Teste.java

What is the current bug behavior?

Portuguese accented characters are not displayed correctly. See the output below.

Isso � um teste de acentua��o em portugu�s.
 �����,  ��,  ��, �

What is the expected correct behavior?

That accented characters are displayed correctly.

System.out.println("Isso é um teste de acentuação em português.");
System.out.println(" áéíóú,  ãõ,  âê, ç");

Output in console should be:

Isso é um teste de acentuação em português.
 áéíóú,  ãõ,  âê, ç
Edited by Marlon Silva