Solved

Greek characters in properties file

Posted on 2009-07-06
4
410 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
pagenation logic how it is working in my code 1 82
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 34
junit example issue 2 58
Html split(text) 2 49
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

739 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