Skip to content

Commit 8253770

Browse files
committed
Escape default arrays and sequences the same other default values
Fix #610 Apply the same encode/decode pattern and escaping as for other default values. Signed-off-by: Jacob Perron <[email protected]>
1 parent 36ed120 commit 8253770

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rosidl_adapter/rosidl_adapter/msg/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def convert_msg_to_idl(package_dir, package_name, input_file, output_dir):
6161

6262
def to_idl_literal(idl_type, value):
6363
if idl_type[-1] == ']' or idl_type.startswith('sequence<'):
64-
content = repr(tuple(value)).replace('\\', r'\\').replace('"', r'\"')
64+
content = repr(tuple(value)).replace('\\', r'\\')
65+
content = content.encode().decode('unicode_escape')
66+
content = content.replace('"', r'\"').replace("'", r"\'")
6567
return f'"{content}"'
6668

6769
if 'boolean' == idl_type:

0 commit comments

Comments
 (0)