Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » WinXP, RCP and Unicode/UTF-8 Labels
WinXP, RCP and Unicode/UTF-8 Labels [message #456652] Sat, 21 October 2006 10:21 Go to next message
Robert Jaemmrich is currently offline Robert Jaemmrich
Messages: 17
Registered: July 2009
Junior Member
Hi,

I'm using UTF-8 as default text file encoding in my RCP application.

All my UTF-8 labels look fine as long as the application gets started inside the Eclipse IDE - but as soon as I'm exporting it as a standalone product, all special UTF-8 characters like german umlauts get lost (the labels are showing typical "wrong codepage artifacts") when running the application.

I tried to set the properties file.encoding and sun.jnu.encoding (VM Arguments -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8) but the problem remains.

Which settings do I need to get the correct "inside Eclipse IDE" behaviour?


Regards,

Robert
Re: WinXP, RCP and Unicode/UTF-8 Labels [message #456653 is a reply to message #456652] Sat, 21 October 2006 15:48 Go to previous messageGo to next message
Robert Jaemmrich is currently offline Robert Jaemmrich
Messages: 17
Registered: July 2009
Junior Member
Robert Jaemmrich schrieb:
> Hi,
>
> I'm using UTF-8 as default text file encoding in my RCP application.
>
> All my UTF-8 labels look fine as long as the application gets started inside the Eclipse IDE - but as soon as I'm exporting it as a standalone product, all special UTF-8 characters like german umlauts get lost (the labels are showing typical "wrong codepage artifacts") when running the application.

The strings are UTF-8 in the class file. But there is no implicit conversion to cp1252 when the labels are shown by the standalone rcp application.

file.encoding and sun.jnu.encoding (you see them in the about view - configuration) don't seem to matter either. :-(


Any help appreciated. :-)

Robert
Re: WinXP, RCP and Unicode/UTF-8 Labels [message #456654 is a reply to message #456652] Sat, 21 October 2006 16:12 Go to previous messageGo to next message
Robert Jaemmrich is currently offline Robert Jaemmrich
Messages: 17
Registered: July 2009
Junior Member
The following snippet does the conversion UTF-8 -> CP1252 correctly (Standalone SWT application). The same label in a standalone RCP application doesn't.

package org.eclipse.swt.snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class SnippetUml {

public static void main(String args[]) {

String myUmlaut = "\u00C4";

Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Label label = new Label(shell, SWT.NONE);
label.setText("A Umlaut (Ä) looks like: "+myUmlaut);

shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
UTF-8 Encoding: Problem solved :-) [message #456661 is a reply to message #456652] Sun, 22 October 2006 15:39 Go to previous messageGo to next message
Robert Jaemmrich is currently offline Robert Jaemmrich
Messages: 17
Registered: July 2009
Junior Member
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.


Regards,

Robert
Re: WinXP, RCP and Unicode/UTF-8 Labels [message #631934 is a reply to message #456652] Sun, 10 October 2010 20:24 Go to previous message
Raffaele Gambelli is currently offline Raffaele Gambelli
Messages: 27
Registered: July 2009
Junior Member
Thank you very much Robert!!! Very Happy

Finally I found your answer, thanks again!

This was a very strange issue...

Bye
Raffaele
Previous Topic:How to run RCP app in headless mode?
Next Topic:window workbench icon still missing
Goto Forum:
  


Current Time: Fri Sep 19 12:02:57 GMT 2014

Powered by FUDForum. Page generated in 0.02501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software