C
C
Cheersman2016-03-10 21:02:14
Java
Cheersman, 2016-03-10 21:02:14

Is it bad to change encoding in NetBeans from UTF-8 to Windows-1251?

Comrades, a possibly stupid question arose, but I could not google well and find a clear answer.
I'm learning Java, at the same time I'm doing all sorts of mini-programs for practice and interest for the sake of it. There was a need to write a phrase in Russian to the console, and then display it.

BufferedReader reado = new BufferedReader(new InputStreamReader(System.in));
String s = reado.readLine();
System.out.println(s);

It would seem that nothing portends trouble, but ����� (Empty squares) clearly got into the console.
After some googling, I found out that the project encoding is corrected, which, in fact, I did in NetBeans. Changed UTF-8 to Windows-1251 and it's good.
Another thing is that I do not quite understand whether this approach has disadvantages. Will it be detrimental to something? And if not, what is the advantage of UTF-8 over cp1251.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
huhrmuhr, 2016-03-10
@Cheersman

UTF-8 is any languages
​​CP1251 - only Russian and Latin without diacritics.
You already have a problem - CP1251 is a Windows standard.
Linux can easily use output in UTF-8.
After the change to CP1251, it will no longer be displayed under Linux.

A
Artem Spiridonov, 2016-03-10
@customtema

1. General applicability
2. Cross-platform
3. Multilanguage
4. Forgot what one word to call that different components and apps interact via API?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question