pyhocon
pyhocon copied to clipboard
HOCONConverter.to_properties escapes equals sign in quoted string and removes quotes
Config:
foo = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="
Code:
from pyhocon import ConfigFactory
from pyhocon import HOCONConverter
config = ConfigFactory.parse_file("test.conf", resolve=False)
print HOCONConverter.to_properties(config)
Result:
foo = -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath\=
Expected result:
foo = "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="
Do we want to keep the quotes? In HOCON, double quotes are optional so after parsing, the quotes are gone. But I can fix the \= easily. Thanks.
Well yes, I'd like to keep the quotes, turning off escaping inside them.
Quoted strings may always be used as an alternative when you need to write a character that is not permitted in an unquoted string.
Moreover, in current implementation it should also escape special symbols like : in unquoted strings.