Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can I use multibyte text in publish and subscribe ?

I don't think that it is supported in ROS1. From ros/wiki/msg - Fields:

unicode strings are currently not supported as a ROS data type. utf-8 should be used to be compatible with ROS string serialization. In python 2, this encoding is automatic for unicode objects, but decoding must be done manually. In python 3, when using str, both encoding and decoding using 'utf-8' in the generated message code.

One workaround I can think of is to instead of using the string type, using the uint8 type. Serialise your wide-string yourself into that uint8 array, publish it, and in the subscriber recreate the wide-string.

That is not nice (as you lose the type info), but could work.