Community
Participate
Working Groups
1. In Java Code Templates, I have a ${date} added to my new classes. But since every date in Eclipse (tested in 3.3M4) is in localized (Unicode) format, and my default Character encoding is Cp1256, "New Java Class" fails, giving: Creation of elements failed. Reason: Some characters cannot be mapped using "Cp1256" character encoding... Is there any option to have ${date} in default ASCII format? 2. Just out of my curiosity :). How did you encoded numbers in date to localized format. I searched all java.text.* (Formatters, ...) to find something for doing that. Is there any class library for this in JDK, or you used a third-party?
- The locale of your machine decides how the date string is formatted: 11/3/06 or 20061102 or whatever. The result is a Java 'String' that can contain all possible Unicode characters - The character encoding decides how the Java string is written to a file It seems your system have a local configured that produces date starings that are not compatible with the character encoding your team or project requires. To change the local: change the locale in the OS or use command line parameters for eclipse To change the encoding: Property page on files or projects The date variable is provided by platform.text. We could allow you to provide a specific locale with the date variable: something like ${date:US_en}
*** This bug has been marked as a duplicate of bug 75981 ***
> - The locale of your machine decides how the date string is formatted: 11/3/06 > or 20061102 or whatever. The result is a Java 'String' that can contain all > possible Unicode characters This is good to have localized date for ${date} variable, but user might not always need to have a locale specific date format in a Java code. > It seems your system have a local configured that produces date starings that > are not compatible with the character encoding your team or project requires. Actually, Windows default encoding for fa_XX or ar_XX is Cp1256 (which is an 8-bit charset). But Eclipse decides to provide date in Unicode (UTF-8 I think) format, ignoring my default encoding (file.encoding system property). > specific locale with the date variable: something like ${date:US_en} Martin, is this possible by now? I could not change ${date} to ${date:US_en} on my 3.3M4 (I20061214-1445) build. It complains: "variable en_US is unknown".