Bookmark Topic Watch Topic
  • New Topic

Valid property file settings  RSS feed

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Report post to moderator
Can anyone tell me what are the rules characters that are and are not allowed in a properties file
key?
 
Jon Strayer
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Report post to moderator
Any character is allowed.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Nope. For starters, only ISO-8859-1 characters are allowed - meaning only chars with a Unicode value in the range 0-255. If you want to put another char in, from Chinese for example, you have to use an escape sequence starting with \u, just like in a Java source file. Furthermore you can't have newlines or returns inside keys or values (unless you precede them with \ to indicate the line is continued on the next line) and you can't have = or : inside a key. (Unless you use a \u followed by the numeric equivalent.) And whitespace is trimmed before & after each key and value.
Details of the format can be found in the API for Properties' load() method.
It's worth noting that the load() and store() methods take care of parsing \u escape sequences and converting them to and from the proper Unicode chars they are supposed to represent. But if you look at a properties file with a simple text editor, you may need to worry about the details of how chars are being represented.
[ July 16, 2003: Message edited by: Jim Yingst ]
 
dwarakanathan thiru
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Report post to moderator
....
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
dwarkanathan,
Please do not hijack other people's threads.
You can start your own thread to ask your question
http://faq.javaranch.com/java/UseOneThreadPerQuestion
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!