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

Support \f (form feed character) #49

Open
Gallaecio opened this issue Jan 18, 2021 · 0 comments
Open

Support \f (form feed character) #49

Gallaecio opened this issue Jan 18, 2021 · 0 comments
Labels

Comments

@Gallaecio
Copy link
Member

Gallaecio commented Jan 18, 2021

>>> js2xml.parse(r'var a = "\f";')
Traceback (most recent call last):
  File "src/lxml/builder.py", line 175, in lxml.builder.ElementMaker.__init__.add_text
  File "src/lxml/etree.pyx", line 1165, in lxml.etree._Element.__getitem__
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/__init__.py", line 18, in parse
    xml = _visitor.visit(tree)
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 23, in visit
    return getattr(self, method, self.generic_visit)(node)
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 31, in visit_ES5Program
    program.extend(self.visit(child))
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 23, in visit
    return getattr(self, method, self.generic_visit)(node)
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 41, in visit_VarStatement
    return [el for child in node for el in self.visit(child)]
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 41, in <listcomp>
    return [el for child in node for el in self.visit(child)]
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 23, in visit
    return getattr(self, method, self.generic_visit)(node)
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 47, in visit_VarDecl
    varel.extend(self.visit(node.initializer))
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 23, in visit
    return getattr(self, method, self.generic_visit)(node)
  File "/home/adrian/.local/share/venv/lib/python3.9/site-packages/js2xml/xmlvisitor.py", line 254, in visit_String
    return [E.string(unescape_string(str_value))]
  File "src/lxml/builder.py", line 228, in lxml.builder.ElementMaker.__call__
  File "src/lxml/builder.py", line 177, in lxml.builder.ElementMaker.__init__.add_text
  File "src/lxml/etree.pyx", line 1018, in lxml.etree._Element.text.__set__
  File "src/lxml/apihelpers.pxi", line 710, in lxml.etree._setNodeText
  File "src/lxml/apihelpers.pxi", line 698, in lxml.etree._createTextNode
  File "src/lxml/apihelpers.pxi", line 1493, in lxml.etree._utf8
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
@Gallaecio Gallaecio added the bug label Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant