When running Eclipse in Windows with the language set to Russian,
Eclipse still shows the text encoding inherited from the container as
cp1252, rather than cp866. This is shown in the 'Resource' properties
page for a new project. Is this the expected behaviour, or a bug?
Matt Dickie wrote:
> When running Eclipse in Windows with the language set to Russian,
> Eclipse still shows the text encoding inherited from the container as
> cp1252, rather than cp866.
Setting the language does not set the encoding. It uses the default
encoding of your OS. This seems to be set to cp1252. You can either
change it for Eclipse on the General > Workspace page or more portable
on the project's property page. The benefit of setting the encoding on
the project is that it will store that value in the repository and when
someone else checks out that project later it will get the correct
encoding no matter what encoding the workspace has.
Dani
> This is shown in the 'Resource' properties page for a new project. Is
> this the expected behaviour, or a bug?
>
> Thanks in advance
>
> Matt
Daniel Megert wrote:
> Setting the language does not set the encoding. It uses the default
> encoding of your OS. This seems to be set to cp1252.
The encoding in the OS is 'cp866'. Executing the windows command 'chcp'
results in the output 'Active code page: 866'.
Having done some further investigation in this bug I discovered https://bugs.eclipse.org/bugs/show_bug.cgi?id=51928. Comment #7 of that
explains that Eclipse picks up the text encoding from the JVM. It can be
changed by setting the system property file.encoding.
I wrote a simple Java test program to print out the value of this
property and it gives 'cp1252' even when 'chcp' gives cp866 as the code
page. This is with with standard Sun JVM for windows.
You can either
> change it for Eclipse on the General > Workspace page or more portable
> on the project's property page. The benefit of setting the encoding on
> the project is that it will store that value in the repository and when
> someone else checks out that project later it will get the correct
> encoding no matter what encoding the workspace has.
I know how to do this. End users of our Eclipse based IDE may expect the
default file encoding to be correct for their locale and language from
the start. We have decided to hack the Eclipse execution wrapper so that
it picks up the text encoding from the OS and sets the default correctly.