Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » utf-8 encoding(Change default eclipse encoding)
utf-8 encoding [message #732026] Mon, 03 October 2011 18:03 Go to next message
linen  is currently offline linen
Messages: 10
Registered: February 2011
Junior Member
Hello

I'm attempting to alter the encoding value for the workspace. I wish for my source files to be encoding using utf-8.

I have discovered that I can change a setting in

Eclipse -> Preferences -> General -> Editors -> TextEditors -> Spelling

About half way down the screen I can see "Encoding". The default value was MacRoman so I selected "Other" and selected "UTF-8" from the drop down.

Is this the only place where that setting is made?

Thanks.
Re: utf-8 encoding [message #732035 is a reply to message #732026] Mon, 03 October 2011 18:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26047
Registered: July 2009
Senior Member
That looks like the encoding for the spelling dictionary itself. I
think you want General->Workspace. There are also properties on a per
project/folder/file basis...


On 03/10/2011 11:03 AM, linen wrote:
> Hello
>
> I'm attempting to alter the encoding value for the workspace. I wish
> for my source files to be encoding using utf-8.
> I have discovered that I can change a setting in
> Eclipse -> Preferences -> General -> Editors -> TextEditors -> Spelling
>
> About half way down the screen I can see "Encoding". The default
> value was MacRoman so I selected "Other" and selected "UTF-8" from the
> drop down.
>
> Is this the only place where that setting is made?
>
> Thanks.
Re: utf-8 encoding [message #732088 is a reply to message #732035] Mon, 03 October 2011 21:40 Go to previous messageGo to next message
linen  is currently offline linen
Messages: 10
Registered: February 2011
Junior Member
Hi Thank you very much for your reponse. Yes I've discovered also that I can set the encoding at
Eclipse -> Preferences -> General -> Workspace
And I can see under Text file encoding to select UTF-8 in the drop down menu marked Other. So I've done that.

I am attempting to retrieve the Irish language, with the fada "é" from a MySQL database. But I am not seeing the fada when I attempt to view output in Log 4 J. I am seeing other characters. And I am running the application in Eclipse. So I'm having trouble understanding the encoding mechanism of the IDE. Any additional advice is appreciated.
Re: utf-8 encoding [message #733271 is a reply to message #732088] Tue, 04 October 2011 15:32 Go to previous messageGo to next message
linen  is currently offline linen
Messages: 10
Registered: February 2011
Junior Member
I've tried to add arguments to the runtime profile for Java. I'm using Eclipse Helios.
Eclipse -> Preferences -> Java -> Installed JREs
I select the JRE, click "Edit" and I have added the following to the text field "Default VM Arguments" -> -Dfile.encoding=UTF-8.
I've also added that to the bottom of the eclipse.ini file in the Application Bundle in Mac OS X. I restarted my computer. But I still don't see proper character formatting.
I'm just confused about how to set encoding for a Java application. I can choose "Irish Extended" from the Character Palatte, which I've set up inside of System Preferences on OS X. I can type Irish including the Irish fada directly into the Eclipse editor. And I can type Irish and the fada directly into the console. So I know the font is fine, and I know that Eclipse can display the character. It just isn't showing up in when I run the Java application. And I don't know what I'm missing or failing to understand.
Re: utf-8 encoding [message #733417 is a reply to message #733271] Tue, 04 October 2011 16:50 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 10/4/2011 11:32 AM, linen wrote:
> I've tried to add arguments to the runtime profile for Java. I'm using
> Eclipse Helios.
> Eclipse -> Preferences -> Java -> Installed JREs
> I select the JRE, click "Edit" and I have added the following to the
> text field "Default VM Arguments" -> -Dfile.encoding=UTF-8.
> I've also added that to the bottom of the eclipse.ini file in the
> Application Bundle in Mac OS X. I restarted my computer. But I still
> don't see proper character formatting. I'm just confused about how to
> set encoding for a Java application. I can choose "Irish Extended" from
> the Character Palatte, which I've set up inside of System Preferences on
> OS X. I can type Irish including the Irish fada directly into the
> Eclipse editor. And I can type Irish and the fada directly into the
> console. So I know the font is fine, and I know that Eclipse can display
> the character. It just isn't showing up in when I run the Java
> application. And I don't know what I'm missing or failing to understand.

Since you say you are running your application within Eclipse, I'm going
to guess that you are looking at the output in the Console window. If
this is correct, setting the "-Dfile.encoding=UTF-8" on the JRE tells
the JVM what encoding you want. However, it doesn't tell the Console
view what encoding to expect. In this case, instead of setting the
"Default VM Arguments", you want Run -> Run Configurations. Select the
launch configuration under the Java Application category. On the Common
tab, select the encoding in the Encoding section. This will set the
"file.encoding" system property for the JVM and tell the Console view to
expect that encoding. If I've guessed wrong, please specify where you
are viewing the incorrect output. I'm not sure how else to interpret
"view output in Log 4 J".

Cheers,
Larry
Re: utf-8 encoding [message #733449 is a reply to message #733417] Tue, 04 October 2011 18:47 Go to previous message
linen  is currently offline linen
Messages: 10
Registered: February 2011
Junior Member
Eclipse Java EE Version : Helios Service Release 1
Java 6
Mac OS X 10.5.8
Tomcat 7

Larry,

Many Thanks for your response. Okay I've accessed the Common Tab and I can see the Encoding option. The radio button that is selected when I open the tab is "Default - inherited (UTF-8)" So I've made no change. I've restarted Eclipse and rerun the application and I still can't see the fada character in the console when I attempt to print the data that is running through the application.

However, I can see the following : System.out.println("Tá sé seo deacair");

That will print the following in the console:

Tá sé seo deacair

Which is exactly predictable and correct. So now I don't think this is an Eclipse issue after all.? Moreover, when I export my application to a war file and run it from my Tomcat instance outside of Eclipse, I am still having problems with printing and viewing runtime data.

So I may need to search elsewhere for the solution to this - But thanks for your help.
Previous Topic:(no subject)
Next Topic:Is the jsdoc @this unsupported?
Goto Forum:
  


Current Time: Wed Sep 17 07:37:58 GMT 2014

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

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