Does anyone know why the colons are getting escaped when I store the properties file?
I’m doing this:
Properties prop = new Properties(); // Set the properties value. prop.setProperty("url","http://localhost:7101/test/home");
And storing using:
prop.store(new FileOutputStream(propFile), null);
It’s working but the output has colons escaped for some reason:
url=http://localhost:7101/test/home
Anyone know a fix?
Advertisement
Answer
In properties files, both of these are legit:
key1 = value key2: value
So both = and : must be escaped.
Now, if you read the thing back with Properties, it’s no problem. Otherwise, you’ll have to write custom code