Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8476021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:03:48+00:00 2026-06-10T18:03:48+00:00

For development I’m using ResourceBundle to read a UTF-8 encoded properties-file (I set that

  • 0

For development I’m using ResourceBundle to read a UTF-8 encoded properties-file (I set that in Eclipse’ file properties on that file) directly from my resources-directory in the IDE (native2ascii is used on the way to production), e.g.:

menu.file.open.label=&Öffnen...
label.btn.add.name=&Hinzufügen
label.btn.remove.name=&Löschen

Since that causes issues with the character encoding when using non-ASCII characters I thought I’d be happy with:

ResourceBundle resourceBundle = ResourceBundle.getBundle("messages", Locale.getDefault());
String value = resourceBundle.getString(key);
value = new String(value.getBytes(), "UTF-8");

Well, it does work nicely for lower-case German umlauts, but not for the upper-case ones, the ß also doesn’t work. Here’s the value read with getString(key) and the value after the conversion with new String(value.getBytes(), "UTF-8"):

&Löschen => &Löschen
&Hinzufügen => &Hinzufügen

&Ã?ber => &??ber
&SchlieÃ?en => &Schlie??en
&Ã?ffnen... => &??ffnen...

The last three should be:

&Ã?ber => &Über
&SchlieÃ?en => &Schließen
&Ã?ffnen... => &Öffnen...

I guess that I’m not too far away from the truth, but what am I missing here?

Google found something similar, but that remained unanswered.

EDIT: a little more code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:03:50+00:00Added an answer on June 10, 2026 at 6:03 pm

    Today I was talking to one of my colleagues and he was pretty much on the same path as the other answers have mentioned. So I tried to achieve what Jon Skeet had mentioned, meaning creating the same file as in production. Since rebuilding the project after each change of a resource is out of question and I hadn’t done any of what solved this (and I guess this will be new to some) let me line it out (even if it may be just for personal reference 😉 ). In short this uses Eclipse’ project builders.

    1. Create an Ant-style build.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <project>
          <property name="dir.resources" value="src/main/resources" />
          <property name="dir.target" value="bin/main" />
      
          <target name="native-to-ascii">
              <delete dir="${dir.target}" includes="**/*.properties" />
              <native2ascii src="${dir.resources}" dest="${dir.target}" includes="**/*.properties" />
          </target>
      </project>
      

      Its intention is to delete the properties-files in the target directory and use native2ascii to recreate them. The delete is necessary as native2ascii won’t overwrite existing files.

    2. In Eclipse go to the project properties and select “Builders”, click “New…”, pick “Ant Builder” (that’s the slightly enhanced editor for run configurations)
    3. In “Main” let “Buildfile” point to the Ant-script, set “Base Directory” to ${project_loc}
    4. In “Refresh” tick “Refresh resources upon completion” and pick “The project containing the selected resource”
    5. In “Targets” click “Set Targets” next to the “Auto Build” and pick native-to-ascii there (note that for some reason I had to do this later again)
    6. This might not be necessary for everybody, but in “JRE” pick a proper execution environment
    7. In “Build Options” tick off “Allocate Console” (however, you may want to keep this ticked on until you see that it’s all working)
    8. “Apply”, “OK”
    9. I was told that the newly created builder should be somewhere underneath the Java Builder (use Up/Down-button)
    10. In the “Java Build Path” select the source folder with the resources (src/main/resources for me) and add an exclusion for **/*.properties

    That should have been it. If you edit a properties-file and save it, it should automatically be converted to ASCII in the output folder. You can try with entering ü, which should end up as \u00fc.

    Note that if you have a lot of properties-files, this may take some time. Just don’t save after every keypress. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For development projects I point real domains to localhost using hosts file. and I
On development server, I am trying to write data to a single file using
Development Environment: Eclipse 3.7.0 Developing: Android 3.2 application for Market Place Using: aChartEngine 0.7.0
During development, I usually test ASP.Net applications using the Web Development Server (sometimes called
Our development team uses Eclipse + Aptana to do their web development work. Currently,
In development mode in eclipse with jetty the fileupload works just fine. I upload
Our development team is planning to upgrade from visual studio 2005 to visual studio
Our development team is making the move to TFS 2010 from VSS. The company
During development I frequently have to deploy a large war-file (~45 MB) to a
During development I've seen xml read errors like this more than once: TestData.ReadFromXml: xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.