Java Properties property value - message with leading white space

java, resourcebundle

Solution

Try doing it like this:

key.blue=\u0020blue

You can use other unicode codes to escape characters as well. All per Java API doc. Quote:

...Characters that cannot be directly represented in this encoding can be written using Unicode escapes ....

Problem

I have messages in properties file and reading these properties file using spring and spring message tag, For example I have : ``` key.red=Red<br> key.blue= blue ``` blue message text coming as "blue" but not as " blue". The leading white spaces are taken out by spring:message tag. how could i retain leading space ? I appreciate any help Thanks, Sri

Original source