Eclipse Yoxos Services Downloads Blogs About
Home > Blogs >

on Jan 9th, 2009Tip: Encoding Issues with Plug-ins

Have you ever come across an issue while developing an Eclipse-based application, go to export it and get an evil “Invalid character constant” message or something similar in your logs? This happens when you’re developing an application that requires Unicode characters but your system file encoding is something other than you expect (i.e., on Macs it’s usually MacRoman and on Windows it’s Cp1252). When you go to export, PDE Build will use the default file encoding (see the file.encoding system property) available to the VM. This can cause problems if you’re using Unicode characters in code and on export, PDE Build chooses a default encoding like Cp1252.

In Eclipse 3.5M5, PDE added some checks to make sure that your project encoding matches what would be exported:

encoding 300x137 Tip: Encoding Issues with Plug ins

This is accomplished via the javacDefaultEncoding.<library> property (in your build.properties file). This doesn’t help you much if you need to do file-specific encodings, but PDE Build supports that via the javacCustomEncodings property. For example:

javacCustomEncodings.. = src/org/foo[US-ASCII],\
src/org/foo/bar.java[ISO-8859-1]

Hope this helps!

Share and Enjoy:

  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins
  • services sprite Tip: Encoding Issues with Plug ins

3 Responses to “Tip: Encoding Issues with Plug-ins”

  1. Kai says:

    Hi Chris,

    I am running exactly into that problem. But specifying “javacDefaultEncoding.. = UTF-8″ in my build.properties for a PDE build doesn’t seem to work. Any hints?

    Thanx

    Kai

  2. Kai says:

    Problem solved: Have to specify this in every build.properties file of every plug-in. But it would be nice if there was a global encoding property that would be used by pde build :)

  3. zx says:

    @Kai, yap… this setting is per-plugin. The ideal solution here would be for PDE Build to be workspace aware but that’s going down another rabbit hole.

Leave a Reply

© EclipseSource 2008 - 2011