Subject: | Bug report in Config::Properties |
Date: | Wed, 20 Aug 2014 13:08:56 +0000 (UTC) |
To: | bug-Config-Properties [...] rt.cpan.org |
From: | Bojan Jovanovic <bojan [...] margintech.com> |
Hello,
Reporting the following bug:
Per wiki page for .properties:
http://en.wikipedia.org/wiki/.properties
key-value pair website-http://en.wikipedia.org/ should be escaped as:
website = http\://en.wikipedia.org/
i.e. colon (:) IS escaped..
Java is doing that as well...
Properties::Config on reading from (java created) properties does
unescaping just fine. However when trying to store updated properties
back (using saveToString), colon (:) is NOT escaped...
Test code below (using internal methods, but that is the root-cause of
the bug - can send the "real case" if needed):
use strict;
use warnings;
use Config::Properties;
my $test_value="#Category meta\n#Tue Aug 19 15:47:04 UTC
2014\nrecommended=\ninputUsedProperties=|35701|35706|35696|35700|35702|35708|35701|35706|35696|35700|35702|35708|\nincludedBack=\nexcluded=\nlayout={\"INPUT\"\\:{\"pages\"\\:[{\"basicInfo\"\\:{\"renderingMode\"\\:\"SHARED\"},\"pageNo\"\\:1,\"categoryId\"\\:1562341,\"additionalInfo\"\\:{\"activeBox\"\\:\"AUTOMATIC\",\"AUTOMATIC\"\\:{\"renderingMode\"\\:\"AUTOMATIC\",\"propertyIds\"\\:[35701,35706,35696,35700,35702,35708]}}}]},\"SEARCH\"\\:{\"boxes\"\\:{\"SMALL\"\\:{\"activeBox\"\\:\"AUTOMATIC\",\"AUTOMATIC\"\\:{\"renderingMode\"\\:\"AUTOMATIC\",\"propertyIds\"\\:[35708,35703]}},\"DETAILED_PLUS_SIMPLE\"\\:{\"activeBox\"\\:\"MANUAL\",\"MANUAL\"\\:{\"propertyLayoutId\"\\:6219,\"renderingMode\"\\:\"MANUAL\"}},\"SMALL_ROOT_SHARED\"\\:{\"SHARED\"\\:{\"propertyLayoutId\"\\:6169,\"renderingMode\"\\:\"SHARED\"},\"activeBox\"\\:\"SHARED\"}},\"type\"\\:\"SIMPLECATSEARCH\"},\"VIEW\"\\:{\"boxes\"\\:{\"ROOT\"\\:{\"activeBox\"\\:\"AUTOMATIC\",\"MANUAL\"\\:{\"propertyLayoutId\"\\:6245,\"rend!
eringMode\"\\:\"MANUAL\"},\"AUTOMATIC\"\\:{\"renderingMode\"\\:\"AUTOMATIC\",\"propertyIds\"\\:[35706,35700]}},\"PROPS\"\\:{\"activeBox\"\\:\"AUTOMATIC\",\"MANUAL\"\\:{\"propertyLayoutId\"\\:6246,\"renderingMode\"\\:\"MANUAL\"},\"AUTOMATIC\"\\:{\"renderingMode\"\\:\"AUTOMATIC\",\"propertyIds\"\\:[35702,35703,35704]}}},\"type\"\\:\"BASICVIEW\"}}\n";
print "Original: $test_value";
Config::Properties::unescape($test_value);
print "Unescaped: $test_value"; // just fine - original Java escaping removed
Config::Properties::escape_value($test_value);
print "Escaping of colon (:) gone!: $test_value";
print $test_value;
Thanks,
Bojan
--