Addresses a bug in SimpleDateFormatter #77

merged 1 commit into from Dec 25, 2011


None yet

2 participants

xeno-by commented Dec 25, 2011

The point is that in Windows with non-English locale the "MMMM" part turns into gibberish. SimpleDateFormatter asks the OS for a byte array that represents month name in system locale, and then transcodes these bytes into utf-8 regardless of the system encoding. On my laptop (with Russian locale) the result looks as following:

build time: 25 ─хърсЁ№ 2011, 15:57:23

Just in case you don't know Russian, this is a meaningless set of characters =)

The solution is to get these bytes from the crazy string produced by SimpleDateFormatter and create a new string that uses correct encoding. However, even if you do this in Ant (which requires writing a custom task), the result will not be perfect:

build time: 25 Декабрь 2011, 15:57:23

Now these characters indeed say "December" in Russian, but the grammatical case of the word "Декабрь" doesn't agree with the numeral "25", so the entire printout isn't a correct Russian phrase.

@paulp paulp merged commit 8a862fd into scala:master Dec 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment