From: Maxym M. <mi...@gm...> - 2005-11-29 09:06:37
|
Suzanne, Something like that... http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java= .io.InputStream) also has > The key contains all of the characters in the line starting with > the first non-white space character and up to, but not including, > the first unescaped '=3D', ':', or white space character other than a > line terminator. All of these key termination characters may be > included in the key by escaping them with a preceding backslash > character; for example, > \:\=3D I see now that it's only the key that _must_ have them escaped. But still they _may_ be escaped in value too. So there're no errors if we escape them. I seems that I have read this long ago and have it half-forgotten ;-) Maxym 2005/11/28, Suzanne Bolduc <suz...@or...>: > Hi Maxym, > > >>Why are high punctuation escaped sometimes, but not always? > > Because Java Resource Bundles standard prefers but not requires > > escaped semicolon (:) > > thank you for the explanations. However, I went to the API specification = for the > Java 2 Platform, Standard Edition, version 1.4.2 (and also 1.5), and foun= d the > following, which seems to imply the opposite... ?? > > Properties (Java 2 Platform SE v1.4.2) > "The method [load] does not treat a backslash character, \, before a non-= valid > escape character as an error; the backslash is *silently* dropped. For ex= ample, > in a Java string the sequence "\z" would cause a compile time error. In > contrast, this method silently drops the backslash. [...] > Escapes are *not* necessary for single and double quotes; however, by the= rule > above, single and double quote characters preceded by a backslash still y= ield > single and double quote characters, respectively." > http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html > > (The same statement appears in Properties (Java 2 Platform SE 5.0) > http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html) > > This whole section made for quite an interesting reading, but I'm not sur= e > whether what I read is actually related to what you call the "Java Resour= ce > Bundles standard"... > > Thanks, > Suzanne > ps. my programmer training ended in 1982, the very year Sun was incorpora= ted > (with 4 employees!), and this was many, many years before the advent of J= ava > (1995)... > > > Maxym Mykhalchuk wrote: > >>Why are high punctuation escaped sometimes, but not always? > > > Because Java Resource Bundles standard prefers but not requires > > escaped semicolon (:), because it may be also used instead of equal > > sign (=3D), having > > key =3D value > > is equivalent to > > key : value > > > >>For instance, the exclamation mark is escaped only in the second of the= se: > > > > As it's also OK to escape any punctuation mark according to Java > > Resource Bundles standard. > > > > As for, e.g. > > > >>SW_SEARCH_TEXT=3DSearch for\: > > > > versus > > > >>INSTANCEEDITOR_SOURCE_MASK=3DSource Filename Pattern: > > > > I suppose one of them was autoinserted by NetBeans > > internationalization tool (respecting every bit of standard and > > escaping semicolon), and another was then edited by human hands > > (taking care only about "if-it-works" matters). > -- Sincerely yours, Maxym Mykhalchuk |