How to fix CMD accentuation error?

Asked

Viewed 892 times

2

I’m having trouble showing messages on cmd because the same when accented appear disfigured. This occurs in any language I use (C, C++, . bat, etc).

For example instead of :

minha multiplicação é :

Appears :

Minha multiplica├º├úo ├® :

I wonder if there is any way to fix this with any specific Windows configuration for the cmd.

Note: Using Windows 8. Setting up with chcp 1252 did not resolve the issue.

  • You said the message appears disfigured. You could edit the question showing the way the message appears?

  • Edited question.

  • The original text appears to be in UTF-8, chcp 1252 is not UTF-8.

  • chcp 860 works?

  • @Victorstafusa all these "old" encodings are single-byte. For UTF-8, it skirts with the 65001, but the best way in my view is to change the font encoding in the IDE.

2 answers

5


First of all: the problem seems to me in its code, and not in the CMD.

If you are going to make applications for the console, the most practical way is to change the encoding in your IDE/text editor to a target OS compatible one, instead of using UTF.

Your string is in UTF-8. In this case you should use:

chcp 65001

It is to be hoped that the 1252 encoding will not work for your case.

  • That’s it. chcp 65001.

  • 1

    @Beto Good night, consider accepting the answer. Since you solved!

-2

For me decided putting CHCP 1252 and saving with ANSI encoding.

Cabeçalho do código da aplicação

Modo de salvar o arquivo

Execução do script com acentuação funcionando!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.