You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by "Greenberg, Gary" <gg...@visa.com.INVALID> on 2022/10/31 20:27:24 UTC

Presentation of non-english characters in the debugger

I have created an application that reads data from the CSV file, process it and write it into another file.
It is working fine except one thing. German characters are being replaced. For example instead of leiüzig I see lei�zig
Same replacement I see in debugger when I stop it after reading a line from file.
I do have in my code
Reader rdr = BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
Later this Reader is used to build CSVReader (from OpenCsv library).

I want to be sure that that problems are in my code and not how debugger displays it.
I haven’t delt with foreign characters encoding before, so please forgive my ignorance.
I would gladly accept advice on my code as well.

I am running NB12.5 on OpenJDK 16 on Windows, but application is running in Java 8 SE.

Gary Greenberg
Staff Software Engineer


RE: Presentation of non-english characters in the debugger

Posted by "Greenberg, Gary" <gg...@visa.com.INVALID>.
Thank you.
However, the problem was of a different nature. I was given a file and told that it is in UTF-8 encoding, but it appeared that it wasn’t.
I converted file to UTF-8 and everything started working as expected.

From: Helmut Leininger <h....@gmx.at>
Sent: Monday, October 31, 2022 1:42 PM
To: users@netbeans.apache.org
Subject: Re: Presentation of non-english characters in the debugger

Hi,
If you read using UTF-8 and then write specifying UTF-8 there should not be a problem.
But Windows does not use UTF-8 by standard I think it uses CP1252 or similar. And a command window (cmd) uses the windows setting. When you write a file in utf-8 an then display it in the command window you will see differencies as you described.
Mit freundlichen Grüßen
Helmut Leininger

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Am 31. Oktober 2022 21:27:24 MEZ schrieb "Greenberg, Gary" <gg...@visa.com.INVALID>>:
I have created an application that reads data from the CSV file, process it and write it into another file.
It is working fine except one thing. German characters are being replaced. For example instead of leiüzig I see lei�zig
Same replacement I see in debugger when I stop it after reading a line from file.
I do have in my code
Reader rdr = BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
Later this Reader is used to build CSVReader (from OpenCsv library).

I want to be sure that that problems are in my code and not how debugger displays it.
I haven’t delt with foreign characters encoding before, so please forgive my ignorance.
I would gladly accept advice on my code as well.

I am running NB12.5 on OpenJDK 16 on Windows, but application is running in Java 8 SE.

Gary Greenberg
Staff Software Engineer


Re: Presentation of non-english characters in the debugger

Posted by Helmut Leininger <h....@gmx.at>.
Hi,
If you read using UTF-8 and then write specifying UTF-8 there should not be a problem.
But Windows does not use UTF-8 by standard I think it uses CP1252 or similar. And a command window (cmd) uses the windows setting. When you write a file in utf-8 an then display it in the command window you will see differencies as you described. 

Mit freundlichen Grüßen 
Helmut Leininger 

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

Am 31. Oktober 2022 21:27:24 MEZ schrieb "Greenberg, Gary" <gg...@visa.com.INVALID>:
>I have created an application that reads data from the CSV file, process it and write it into another file.
>It is working fine except one thing. German characters are being replaced. For example instead of leiüzig I see lei�zig
>Same replacement I see in debugger when I stop it after reading a line from file.
>I do have in my code
>Reader rdr = BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
>Later this Reader is used to build CSVReader (from OpenCsv library).
>
>I want to be sure that that problems are in my code and not how debugger displays it.
>I haven’t delt with foreign characters encoding before, so please forgive my ignorance.
>I would gladly accept advice on my code as well.
>
>I am running NB12.5 on OpenJDK 16 on Windows, but application is running in Java 8 SE.
>
>Gary Greenberg
>Staff Software Engineer
>