Explorar o código

NodesetCompiler: Correctly escape quotation and slashes

Stefan Profanter %!s(int64=5) %!d(string=hai) anos
pai
achega
2033d6a413
Modificáronse 1 ficheiros con 1 adicións e 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):
     """