Reputation: 4342
do I really need to resort ot raw unicode char escapes to embed newlines into my .properties file?
This lengthy discussion in documentation is cool but I somehow miss this point. Now trying to scan this bulk once again, but maybe someone knows?
Thanks, Anton
update
certain special characters, can be represented in keys and elements using escape sequences similar to those used for character and string literals
I was not that sure what those 'certain special characters' might be. The direct link from 1.4 javadocs did not lead to the proper section of the spec. But after looking up the proper paragraph this got quite clear for me.
Upvotes: 16
Views: 27142
Reputation: 9941
The line of the referenced 1.4 API Text that matters is:
The ASCII characters
\
, tab, form feed, newline, and carriage return are written as\\
,\t
,\f
,\n
, and\r
, respectively.
Upvotes: 6
Reputation: 1500225
do I really need to resort ot raw unicode char escapes to embed newlines into my .properties file?
Nope. I'd expect \r
or \n
or \r\n
to work just fine. You claim that the linked documentation misses the point, but it seems pretty relevant to me:
Characters not in Latin1, and certain special characters, can be represented in keys and elements using escape sequences similar to those used for character and string literals (see §3.3 and §3.10.6 of the Java Language Specification).
Section 3.10.6 is what you want, right?
Upvotes: 24