我是否真的需要使用原始的unicode char转义来将换行符嵌入我的.properties文件中?
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?
谢谢, Anton
Thanks, Anton
更新
某些特殊字符,可以表示键和使用转义序列的元素类似于使用表示字符和字符串文字的元素
certain special characters, can be represented in keys and elements using escape sequences similar to those used for character and string literals
我不是那样的确定那些'某些特殊字符'可能是什么。 1.4 javadocs的直接链接没有导致规范的正确部分。但在查找正确的段落之后对我来说很清楚。
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.
推荐答案
我真的需要使用原始的unicode char转义来将换行符嵌入我的.properties文件?
do I really need to resort ot raw unicode char escapes to embed newlines into my .properties file?
不。我希望 \ r 或 \ n 或 \\\\ n 工作正常。您声称链接文档遗漏了这一点,但它似乎与我非常相关:
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:
不在Latin1中的字符,以及某些特殊字符,可以使用类似于用于字符和字符串文字的转义序列在键和元素中表示(参见Java语言规范的§3.3和§3.10.6)。
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).
第3.10.6节是你想要的,对吗?
更多推荐
java .properties文件值中的换行符
发布评论