Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Text encoding not picked up from container
Text encoding not picked up from container [message #481586] Fri, 21 August 2009 12:45 Go to next message
Matthew Dickie is currently offline Matthew Dickie
Messages: 56
Registered: July 2009
Member
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?

Thanks in advance

Matt
Re: Text encoding not picked up from container [message #481744 is a reply to message #481586] Mon, 24 August 2009 03:59 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
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
Re: Text encoding not picked up from container [message #481864 is a reply to message #481744] Mon, 24 August 2009 11:22 Go to previous message
Matthew Dickie is currently offline Matthew Dickie
Messages: 56
Registered: July 2009
Member
Hi Daniel,


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.

Thanks for your help

Matt D.
Previous Topic:Handler and JUnit test
Next Topic:Overlay Icon
Goto Forum:
  


Current Time: Wed Jul 30 09:12:57 EDT 2014

Powered by FUDForum. Page generated in 0.02516 seconds