Incorrect Date Formatting in Sun JDK 1.5 Russian Locale Implementation
Even though Russian is one of the few languages i can speak and I have worked on both the internationalization of Web applications, as well as Java quite a lot, in the past, particular problem of Russian i18N has never come to my attention. That is - until now.
Unfortunately, I was unpleasantly surprised as soon as I touched it - Sun JDK 1.5.x does not format dates correctly with Russian Locale.
The deal with Russian language is that month names have different suffix when they are presented stand-alone (i.e. in a list or smth) and yet another one when they are part of a formatted date. So, even though March is "ÐœÐ°Ñ€Ñ‚" in Russian, correctly formatted today's date would be: "7 ÐœÐ°Ñ€Ñ‚Ð° 2007 Ð³."
Let's see how JDK fortmats today's date: 7 ÐœÐ°Ñ€Ñ‚ 2007 Ð³. Clearly wrong.
It's very sad. No matter how you feel about it, Russian is one of the major languages and Sun could have put enough effort to get it right.
Below is the test JSP code:
<%@page pageEncoding="UTF-8"%> <%@page contentType="text/html;charset=UTF-8"%> <%@ page import="java.util.*" %> <%@ page import="java.text.*" %> <HTML> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <BODY> Current date (Russian): <% Locale locale = new Locale("ru","RU"); DateFormat full = DateFormat.getDateInstance(DateFormat.LONG, locale); out.println(full.format(new Date())); %> </BODY> </HTML>