Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error on escaped quotes in double quoted strings #82

Closed
GoogleCodeExporter opened this issue Apr 13, 2015 · 2 comments
Closed

syntax error on escaped quotes in double quoted strings #82

GoogleCodeExporter opened this issue Apr 13, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link


According to http://www.graphviz.org/doc/info/lang.html, an ID can be:
...
'any double-quoted string ("...") possibly containing escaped quotes (\")1;'

pydot does not properly read double quoted strings with escaped quotes

What steps will reproduce the problem?
1. pydot.graph_from_dot_data("graph G { a [test=\"\\\"escaped quotes\\\"\"] }")

or

1. create the following DOT file:
graph G {
  a [test="\"escaped quotes\""]
}
2. pydot.graph_from_dot_file("file.dot")

What is the expected output? What do you see instead?
expected output: <pydot.Dot object at 0xb483de8c>
output: 
graph G { a [test="\"escaped quotes\""] }
            ^
Expected "}" (at char 12), (line:1, col:13)


What version of the product are you using? On what operating system?
pydot 1.0.28; Python 2.7.3; Gentoo/Linux 3.0.6

Please provide any additional information below.

A suggested patch is attached. Apply to dot_parser.py
patch -Np1 dot_parser.py escChar.patch 

Original issue reported on code.google.com by cdur...@gmail.com on 1 May 2013 at 3:34

Attachments:

mattiasa pushed a commit to CantemoInternal/pydot that referenced this issue Oct 22, 2015
@peternowee
Copy link
Member

This was fixed in commit 160c1997, with a test for it added in 19156bdc. See #132 and #134 for discussion. The first release that included the fix was pydot 1.2.3.

Just to be sure, a manual test (with current pydot 1.4.1):

>>> print(pydot.graph_from_dot_data("graph G { a [test=\"\\\"escaped quotes\\\"\"] }")[0].get_node_list()[0].get_attributes()['test'])
"\"escaped quotes\""
>>> print(pydot.graph_from_dot_data("graph G { a [test=\"\\\"escaped quotes\\\"\"] }")[0].get_node_list()[0].get_attributes())
{'test': '"\\"escaped quotes\\""'}

So, I think this issue can be closed.

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

No branches or pull requests

2 participants