Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

Greek characters in properties file

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
brian-barnett
Asked:
brian-barnett
  • 2
  • 2
1 Solution
 
a_bCommented:
Add the following directive on each JSP -
<%@ page contentType="text/html; charset=UTF-8" pageEncoding=<Specify the greek encoding here> %>
0
 
brian-barnettAuthor Commented:
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
 
a_bCommented:
Try - <%@ page language="java" contentType="text/html;UTF-8" pageEncoding="UTF-8" %>

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

0
 
brian-barnettAuthor Commented:
Much better. Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now