Open karthiknit1 opened 3 years ago
I'm able to reproduce this using the most recent Foxy
binaries
Build succeeds
wstring test_default "ö"
wstring[] test_default ["H"]
string test_default "ö"
Fails to build with UnicodeDecodeError
wstring[] test_default ["ö"]
string[] test_default ["ö"]
I'm also able to reproduce on master
branches, so this is probably an issue in ROS Galactic and ROS Rolling too.
Looks like an encoding issue in the generated idl file, the problem is probably somewhere in rosidl_adapter
// generated from rosidl_adapter/resource/msg.idl.em
// with input from wstr_msg/msg/WstrTest.msg
// generated code does not contain a copyright notice
module wstr_msg {
module msg {
struct WstrTest {
@default (value="('�',)")
sequence<string> test_default;
};
};
};
Probably, the issue is coming due to latin-1 encoding which is merged as part of this commit:https://github.com/ros2/rosidl/pull/391/commits/aae1e9acca558c381dafb293d3c5c85749d5ac1b
This is not merged in dashing and also the build succeeds there.
Probably, the issue is coming due to latin-1 encoding which is merged as part of this commit
I'm not sure about that. It seems to be the right encoding to output to: https://www.omg.org/spec/IDL/4.2/PDF Section 7.2
IDL uses the ASCII character set, except for string literals and character literals, which use the ISO Latin-1 (8859-1)
character set.
Is there any fix/workaround available for this issue?
See https://github.com/ros2/rosidl/pull/620 for a fix.
Bug report
Required Info:
Steps to reproduce issue
In Foxy, do colcon build for ros2 custom message with Wstrings.msg as shown below:
Wstrings.msg
Build fails with the following error:
Expected behavior
Build should be successful
Actual behavior
Build failed
Additional information
Build is successful in ros2 dashing but broken in foxy. In the Wstrings.msg file, these are the fields which are actually causing the failure in foxy.
stdout_stderr.log Also, looking at the ros2 foxy codebase, I see that tests are missing for WstringArrays but present for StringArrays: