Hello,
I am trying to store a string that contains special characters like \, \n, which are normally escaped using a \ character. If I try to save the Properties object into a file (using the store() method call), it doesn't store these escape characters as they are. The following is what I am trying to do:
Properties p = new Properties();
String samp = "This string will have a \\ and a newline \ncharacter";
p.setProperty( "sample", samp );
p.store( new FileOutputStream( "/path/to/my/file" ) );
I am trying to achieve the following result:
sample=This string will have a \ and a newline
character
But, instead, I get this:
sample=This string will have a \\ and a newline \\\ncharacter
Can somebody help me with this problem?
Thanks,