Skip to content

Conversation

@YK-Samgo
Copy link

#293

It seems not difficult to fix. But don' know side effect.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 94.371% when pulling 628f923 on YK-Samgo:master into be660de on chimpler:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 94.371% when pulling 628f923 on YK-Samgo:master into be660de on chimpler:master.

'\\#': '#',
'\\!': '!',
'\\"': '"',
'\/': '/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be \\/ instead? Do you have an example where you use it?

Copy link
Author

@YK-Samgo YK-Samgo May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shown in #293 , json use \/ in unix path string like {"path":"\/var"}.

pyhocon does not parse it correctly as jq does.

# echo '{"path":"\/var"}' | jq .
{
  "path": "/var"
}
# echo '{"path":"\/var"}' | pyhocon
{
  "path": "\\/var"
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python handles \ in a strange way. '\/', '\\/', "\/" and "\\/" all work.

Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('\/')
\/
>>> print("\/")
\/
>>> print("\\/")
\/
>>> print('\\/')
\/
>>> '\/var'.replace('\/','/')
'/var'
>>> '\/var'.replace('\\/','/')
'/var'
>>> '\/var'.replace("\/",'/')
'/var'
>>> '\/var'.replace("\\/",'/')
'/var'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax is described in RFC 8259 Section 7 Strings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants