Explorar el Código

NodesetCompiler: Correctly escape quotation and slashes

Stefan Profanter hace 5 años
padre
commit
2033d6a413
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      tools/nodeset_compiler/backend_open62541_datatypes.py

+ 1 - 1
tools/nodeset_compiler/backend_open62541_datatypes.py

@@ -17,7 +17,7 @@ def makeCIdentifier(value):
 
 # Escape C strings:
 def makeCLiteral(value):
-    return re.sub(r'(?<!\\)"', r'\\"', value.replace('\\', r'\\\\').replace('\n', r'\\n').replace('\r', r''))
+    return re.sub(r'(?<!\\)"', r'\\"', value.replace('\\', r'\\').replace('"', r'\"').replace('\n', r'\\n').replace('\r', r''))
 
 def splitStringLiterals(value, splitLength=500):
     """