Default charset for Eclipse projects

Home for older / inactive topics

Default charset for Eclipse projects

Postby ptalbot » Fri Jun 11, 2010 7:21 am

What default charset do you use for your workspaces?

Right now all the projects of Servoy 5.2 uses a setting for 'Text file encoding' that is 'Inherited from Container' - in my case it is UTF-8, but I've seen some properties that were not correctly interpreted, like the signature in the Splash window where the copyright symbold appears as a square character if I launch it in debug mode, when launched out of Eclipse, it appears correctly.
This is why I think that your workspace settings are different and I wonder if that could not cause problems elsewhere.

Any ideas?
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Default charset for Eclipse projects

Postby rgansevles » Fri Jun 11, 2010 10:23 am

Patrick,

I have replaced all copyright characters with their unicode notation so that all source is in ascii.

Thanks for noting,

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1929
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Default charset for Eclipse projects

Postby ptalbot » Fri Jun 11, 2010 2:55 pm

Thanks Rob, but actually I was more worried about other places where this could break, so I wanted to know which charset to use.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Default charset for Eclipse projects

Postby jcompagner » Wed Jul 07, 2010 4:55 pm

most of the time the type of file defines how it does store the contents,
like java propertie files should be: ISO 8859-1, xml files define it in there headers tag.
java files are not specified to one encoding, they take the system encoding. This is in my eyes a mistake of sun, they should have fixed it to UTF8
So for java files it is better to use plain ascii...
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8884
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Default charset for Eclipse projects

Postby ptalbot » Wed Jul 07, 2010 5:13 pm

OK then. Thanks!
But I think I will use a special instance of Eclipse for Servoy sources if it is to use ASCII, because if I set it as Eclipse default all my other projects (currently using UTF-8) will be corrupted when I edit the files.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Default charset for Eclipse projects

Postby jbader » Wed Jul 07, 2010 5:17 pm

java propertie files should be: ISO 8859-1


I actually was going around in circles with this recently, as I was not aware that .properties files were required to be latin-1. I had sent my solution's i18n to a translation service, and got back a UTF-8 encoded file. When I brought this into Servoy, the first time I opened the i18n editor and saved/updated/added, my high-ascii (accented latin in my case) was changed to unicode literals. This was probably a result of Servoy implementing some version of native2ascii? The trouble I ran into though was that b/c the file was not latin-1, the native2ascii conversion of the high ascii chars to unicode didn't work properly, and I ended up with a completely defunkt .properties file. What I ended up having to do was run native2ascii at the command line on the utf-8 file and pass in a flag that told it that the file was actually utf-8. When I did this the high ascii was escaped properly and then when I brought it into servoy all was well.

I think that in order to prevent other's from learning all of this the hard way as I did, perhaps Servoy can run a charset detect on the .properties file and pass the gotten encoding as a flag to its native2ascii implementation? This will make it somewhat dummy proof.

Just an FYI/sharing my experience
jbader
 
Posts: 520
Joined: Sun Sep 18, 2005 4:24 am
Location: Miami, FL

Re: Default charset for Eclipse projects

Postby ptalbot » Wed Jul 07, 2010 5:35 pm

Yes, properties should be ISO-8859-1

But Jeff do you mean you still don't know how to escape your utf files by hand?
I've perfected along the years the use of \u00E9 and \u00E8 in French ;-)

For native2ascii, I don't thing Servoy is doing anything. Eclipse does.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Default charset for Eclipse projects

Postby jbader » Wed Jul 07, 2010 6:24 pm

But Jeff do you mean you still don't know how to escape your utf files by hand?


Well I could do it I suppose by hand if I had a table of escape sequences for all the high-ascii in Spanish and Brazilian Portuguese (which I guess I do on the Mac), but the problem for me was that I *didn't do it originally* and then had a couple thousand values to deal with in a utf-8 file after the fact. The problem here was really my ignorance; not knowing the .properties had to be ISO-8859-1, doesn't have a whole lot to do with Servoy itself.
jbader
 
Posts: 520
Joined: Sun Sep 18, 2005 4:24 am
Location: Miami, FL

Re: Default charset for Eclipse projects

Postby jbader » Wed Jul 07, 2010 6:33 pm

But Patrick I'm not convinced that Servoy had envisioned it's developers writing the escape sequences directly into the i18n editor in the first place. I say that because there is some implicitness that happens if you pay attention...

The editor itself appears to be UTF-8. You can see this because high-ascii (whcin in the .properties file is escaped) is displayed as its character in the list of i18n values and in the editing boxes themselves within the i18n editor window. You can type high ascii characters directly into the i18n editor. As soon as you save/add/update, Servoy (or eclipse?) escapes the high ascii chars and writes the proper escape sequences to the .properties file (assuming your .properties file is ISO...).

So really (at least in my experience in 5.1.x) you don't have to think about the escape sequences, or type them into the i18n editor.
jbader
 
Posts: 520
Joined: Sun Sep 18, 2005 4:24 am
Location: Miami, FL

Re: Default charset for Eclipse projects

Postby ptalbot » Wed Jul 07, 2010 7:20 pm

jbader wrote:But Patrick I'm not convinced that Servoy had envisioned it's developers writing the escape sequences directly into the i18n editor in the first place. I say that because there is some implicitness that happens if you pay attention...

The editor itself appears to be UTF-8. You can see this because high-ascii (whcin in the .properties file is escaped) is displayed as its character in the list of i18n values and in the editing boxes themselves within the i18n editor window. You can type high ascii characters directly into the i18n editor. As soon as you save/add/update, Servoy (or eclipse?) escapes the high ascii chars and writes the proper escape sequences to the .properties file (assuming your .properties file is ISO...).

So really (at least in my experience in 5.1.x) you don't have to think about the escape sequences, or type them into the i18n editor.


I was only joking :lol:
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC


Return to Archive

Who is online

Users browsing this forum: No registered users and 0 guests