Addresses a bug in SimpleDateFormatter #77
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.