Solved

Greek characters in properties file

Posted on 2009-07-06
4
413 Views
Last Modified: 2013-12-15
I created a simple .properties file with Greek characters in Notepad and saved it as UTF8 file. I ran native2ascii and have the following:

\ufeff
det03.loanAmount \u03a0\u03bf\u03c3\u03cc \u0394\u03b1\u03bd\u03b5\u03af\u03bf\u03c5
det03.interestRate \u0395\u03c4\u03ae\u03c3\u03b9\u03bf \u0395\u03c0\u03b9\u03c4\u03cc\u03ba\u03b9\u03bf (%)
det03.termMonths \u0394\u03b9\u03ac\u03c1\u03ba\u03b5\u03b9\u03b1 \u0394\u03b1\u03bd\u03b5\u03af\u03bf\u03c5 (\u03c3\u03b5 \u03bc\u03ae\u03bd\u03b5\u03c2)
det03.amortization \u0391\u03c0\u03b5\u03b9\u03ba\u03cc\u03bd\u03b9\u03c3\u03b7 \u03c0\u03c1\u03bf\u03b3\u03c1\u03ac\u03bc\u03bc\u03b1\u03c4\u03bf\u03c2 \u03b1\u03c0\u03bf\u03c0\u03bb\u03b7\u03c1\u03c9\u03bc\u03ae\u03c2 \u03b4\u03b1\u03bd\u03b5\u03af\u03bf\u03c5

In my jsp file, I want to output these Greek characters using the bean:message tag like this:

<bean:message key="det03.loanAmount"/>

but all I get are question marks in the html page. ???? ?????????

What am I missing?
0
Comment
Question by:brian-barnett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:a_b
ID: 24791741
Add the following directive on each JSP -
<%@ page contentType="text/html; charset=UTF-8" pageEncoding=<Specify the greek encoding here> %>
0
 

Author Comment

by:brian-barnett
ID: 24791780
That suggestion worked, but now I have locale specific code in my jsp pages. I thought Java/Struts provided localization/i18n support without having to add locale specific code?? What happens when I want to use Japanese characters? Seems like with this solution I'd have to add conditional logic in the jsp pages to specify the value of the pageEncoding attribute for each encoding I want to use.

Is there a solution that does not require conditional logic in my code? I am setting the session locale variable based on form values (language and country). I was under the impression from my reading that setting the session locale variable and providing .properties files was all I needed and that the locale-sensitive classes, like the bean tags, would handle everything else properly.
0
 
LVL 20

Accepted Solution

by:
a_b earned 500 total points
ID: 24791816
Try - <%@ page language="java" contentType="text/html;UTF-8" pageEncoding="UTF-8" %>

Donot specify the greek encoding. Check and let me know.

0
 

Author Closing Comment

by:brian-barnett
ID: 31600480
Much better. Thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question