Closed vibin closed 4 years ago
TBF, I'm not sure if this is a bug (i'm new to ruby), but the JDK Properties API definitely does unescape backslashes.
This is in fact an interesting behavior. I checked the Java behavior and you' right, a property with a back\\slash
value will be parsed to back\slash
.
Obviously this is important for situations with escaped special chars, e.g. back\\tslash
where the sequence should not contain a tabulator.
@vibin I added a fix for this behavior. Can you test the new version? If you use this gem via a Bundler you can simply use the following line to your Gemfile
load the unpublished version:
gem 'java-properties', github: 'jnbt/java-properties', branch: 'fix-backslash-not-unescaped'
and then run bundle install
@jnbt this fixes the issue. Thank you!
@vibin Thanks for your feedback. The fix has been released as version 0.2.1
: https://rubygems.org/gems/java-properties/versions/0.2.1
For
hello=wo\\d
, the APIJavaProperties.load("sample.properties")['hello'.to_sym]
returnswo\\d
instead ofwo\d
.