Eclipse-RCP Wrong encoding when deploying the product
Asked Answered
C

3

13

I am creating an RCP application, with many Greek messages, so everything is in UTF-8. As I develop and test through Eclipse IDE, everything is fine.

When I am deploying through "Eclipse Product export Wizard" the resulting exe does not correctly display the Greek letters.

I know that I am missing something stupid, but I have no idea what. Could you please help?

Crumpton answered 31/7, 2011 at 17:33 Comment(1)
Nice work. Please close this question as answered.Landel
P
11

(copied from the question - so this shows as having an answer)

I found the solution although it was not as trivial as I anticipated.

Eclipse gives the ability to control the build process with build.properties, in which you can specify a property javacDefaultEncoding with the following value for example

javacDefaultEncoding..=UTF-8

Documentation can be found at Eclipse Help in "Plug-in Development Environment Guide > Reference > Build Configuration"

Hope this helps someone.

Propulsion answered 29/5, 2012 at 4:37 Comment(0)
T
3

The trick is to start the Eclipse IDE using the same file.encoding as the java editor uses:

eclipse -vmargs -Dfile.encoding=UTF-8

AND

Window -> Preferences... -> General -> Workspace -> Text file encoding -> Other -> UTF-8

When you export your RCP application then, the UTF-8-labels are displayed correctly. There are no special VM arguments needed to start the RCP application.

With this, you can share UTF-8 source code between Linux and Windows Eclipses.

Tread answered 6/11, 2012 at 21:25 Comment(1)
Note that this is useful for specifying the encoding for every plugin or product created with that version of Eclipse. If the encoding only needs to be changed for a specific project then see the answers (from Francis Upton and mkdev) above this one.Maverick
G
3

When exporting a plug-in, it gets compiled through a process separate from the normal build process within the IDE. There is a known bug that the build process (PDE.Build) disregards the text encoding used by the IDE.

The export can be made to work properly by specifying the text encoding in the build.properties file of your plugin

javacDefaultEncoding.. =  UTF-8
Gary answered 6/7, 2013 at 10:55 Comment(1)
Note that this is useful for specifying the encoding for a specific project. If the encoding will always be UTF-8 (for example) then see the answer (from marcolopes) below this one.Maverick

© 2022 - 2024 — McMap. All rights reserved.