Scala Results Encoding Eclipse Worksheet Plugin

How can I change the encoding for the results in a worksheet in Eclipse?

object workbook1 { "cyrillic A is: " + "" //> res0: String("cyrylic A is: Ρ’") = cyrylic A is: Ρ’ } 

Editor Coding - UTF-8. The results are printed right in the editor window, but the encoding of the results is different. This is on Windows.

+3
source share
2 answers

Many thanks to the original question and @Excelan's solution as it definitely made me point in the right direction!

I ran into this problem using the Scala Eclipse IDE when working with new projects that I created, but did not experience problems when using imported projects. As soon as I saw the Excelan comment about the encoding I started working with, you can change the encoding of the Eclipse default text file for all projects in the settings, for example:

  Open Preferences Expand the "General" menu. Select the "Workspace" menu. Change "Text file encoding" option from Default to Other and select UTF-8. 

As soon as I completed these steps, I closed and re-eclipse. Each new worksheet created after this works great!

Screencap of preferences

To change settings at the project level, right-click the project and select properties. The encoding of the text file is in the Resources menu.

To change the settings for a single file, right-click the file and select properties. The encoding of the text file is in the Resources menu.

+8
source

This is because the JVM treats the input strings as encoded with the system default value (cp1251 in my case)

You must tell the JVM that the input lines are in UTF-8. To do this, enter eclipse.ini :

-Dfile.encoding = UTF-8

If there is a better (design local) solution, let me know. This seems like a Windows related issue.

+5
source

Source: https://habr.com/ru/post/950820/


All Articles