Encoding without configuration: Eclipse (JSP) and Vscode

Asked

Viewed 910 times

1

I have some problems related to encoding. Both in eclipse and Visual Studio Code are aimed at UTF-8. When I repair and save using the eclipse, it goes fine. But when I save in Vscode, the encoding fails.

Follow an example: Encoding desconfigurado ao salvar no eclipse

I use the eclipse only to compile my application, and I feel much more comfortable when developing in Vscode.

3 answers

1

I managed to isolate the problem and ended up discovering that this problem is inherited from the eclipse. For such a test, I did the following procedures:

  1. I created files in Vscode and Notepad with extension . txt, and both opened normally
  2. I created files in both applications with the .jsp. extension. When I also created in the notepad and Vscode, the two communicated well, but when I opened in Eclipse, gave error in the characters.

So, error in eclipse!

1

If you are in English your Vscode, confirm that the configuration is correct:

  1. Go on File -> Preferences -> User Settings
  2. Add the input "files.encoding": "utf8" in the right window and save.

You can also choose to add only the entry:

"files.autoGuessEncoding": true

And let Visual Studio Code guess the open file encoding as explained in the documentation:

When enabled, will Attempt to Guess the Character set encoding when Opening files. This Setting can be configured per language Too.

  • In my Vscode you already find in this configuration: "files.encoding": "utf8"

  • 1

    @Thiagocunha tried to use the files.autoGuessEncoding? The problem may also be in Eclipse (using other encoding than UTF-8)

  • I tried yes! I went there in the eclipse, and UTF-8 is still being used, including in the configuration of the project.

  • 1

    @Thiagocunha, are you using Windows? If yes, open the file in Notepad, go to File > Save As and see what appears selected in the "Encoding"

  • ANSI, UTF-8, UNICODE, UNICODE BIG Endian

  • 1

    Which one appears selected when you open the file? This is the current encoding of the file. I asked you to confirm the file encoding.

  • In my eclipse this:Text file encoding: UTF-8/ New text file line demimiter: Unix

  • 1
Show 3 more comments

0

Good afternoon, everyone,

First excuse for the poverty of arguments.

I ran a test on VS by changing the encoding (File > Preferences > Settings > Files: Encoding) to utf8bom (Byte order mark). It seems that it does not have major implications for the project. (Source: What is the difference between GOOD and NO GOOD encoding files? )

In this way, the Eclipse began to identify the accents correctly.

I hope I’ve helped!

Browser other questions tagged

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