?
Solved

Greek characters in properties file

Posted on 2009-07-06
4
Medium Priority
?
414 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

719 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