NetBeans, Ruby, Rails and the story of UTF8

Posted on December 23, 2009

I am a NetBeans user for about 4 years now. Although Eclipse is still my Number 1 IDE for Java, NetBeans is my only IDE for Ruby on Rails.

In my Ruby development I noticed that there are some problems with the encoding. First I thought that the problem was Ruby, but it wasn’t. Then I checked a couple of NetBeans settings. For example you can set the encoding in the project settings:

NetBeans Project  Settings

However, nothing helped. After some Google research I came across this blog entry. It says that NetBeans doesn’t use UTF 8 for file encoding by default! My first thought was “why not?”! So to recap this, the actual project setting is UTF8, but the file encoding isn’t! To enable UTF8 encoding for the files too, you have to:

  1. go the etc folder in the NetBeans directory
  2. open the netbeans.conf
  3. and add the following to the netbeans_default_options => -J-Dfile.encoding=UTF-8

After that everything works correctly and I can see the German Umlaute once again, in the file view and in the output window.

Lingui.st - Online Resource Editor, Manage your Ruby/Rails, Java, .Net and C++ language files with ease

Related posts:

  1. Netbeans 6.1 beta review
  2. Ruby on Rails 2.2
  3. NetBeans 6.7 review
  4. Netbeans 6.7 beta is out in the wild
  5. Resque Jobs automatically require Rails environment and Lib Classes

Tags: , , , , ,

Leave a Reply