pyhocon icon indicating copy to clipboard operation
pyhocon copied to clipboard

HOCONConverter.to_properties escapes equals sign in quoted string and removes quotes

Open alexey-terentiev opened this issue 9 years ago • 2 comments

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="

alexey-terentiev avatar Apr 21 '16 15:04 alexey-terentiev

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.

darthbear avatar Apr 24 '16 01:04 darthbear

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.

alexey-terentiev avatar Apr 25 '16 12:04 alexey-terentiev