Skip Menu |

This queue is for tickets about the Config-Properties CPAN distribution.

Report information
The Basics
Id: 98225
Status: resolved
Priority: 0/
Queue: Config-Properties

People
Owner: Nobody in particular
Requestors: bojan [...] margintech.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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 --
According to Java documentation (http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html) that AFAIK, is the reference one regarding the .properties format, quoting the colon (":") is only required on the key side. Config::Properties tries to minimize quoting in order to improve the (human) readability of the generated files. Particularly not mangling URLs is a good reason to keep the colon unquoted. What's your real problem? interoperability issues with some particular software?
Subject: Re: [rt.cpan.org #98225] Bug report in Config::Properties
Date: Fri, 8 May 2015 12:18:23 +0000 (UTC)
To: Salvador Fandino Garcia via RT <bug-Config-Properties [...] rt.cpan.org>
From: Bojan Jovanovic <bojan [...] margintech.com>
My software in particular is doing a diff of the original Java generated properties (minus the timestamp), and what was generated by perl. They simply do not match due to a difference in escaping, due to : escaping on the java side. I see your point about minimizing the quoting, but Java itself does not do it that way, and wikipedia shows that : should be escaped, just like java does.. Either way, I solved my issue by modifying the code by hand, but IMO Config::Properties should match java as closely as possible..
Version 1.80 I have just uploaded, has support for a new feature 'be_like_java' that when enabled will generate output quoted in the same fashion as Java does. If you find any other discrepancy between the generated output and the one from Java, don't hesitate to reopen this ticket and report it.