Encoding issue in command line but not in eclipse output

时间:2019-04-08 13:28:18

标签: java character-encoding log4j

Well, I'm running a spring boot app with some arguments like this :

My method is :

public static String getParam(String args) {
    String param = args.substring(args.indexOf("=")+1);
    log.info("Argument détécté : "+param);
    return param;
}

but my output is :

test.dialog.DialogApplication         : Argument dÚtÚctÚ : XXXX
test.dialog.DialogApplication         : Argument dÚtÚctÚ : YYYY

My execution call is :

mvn spring-boot:run -Dspring-boot.run.arguments=--param=XXXX,--param2=YYYY

But if I run it through eclipse :

test.dialog.DialogApplication       Argument détécté : XXXX

May someone explain me why encoding seemns different between command line and eclipse STS4 output and if possible how to get nice accentued logs :-)

PS : i'm running on Win10

1 个答案:

答案 0 :(得分:0)

Encodings need to be supported by the outputting programm aswell.

Eclipse does support UTF-8 (usually the default setting) hence the output is correctly displayed. For command line it depends on the console you run mvn spring-boot:run -Dspring-boot.run.arguments=--param=XXXX,--param2=YYYY in.