[ros-users] [Discourse.ros.org] [Client Libraries] Python3 a…

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Asmodehn via ros-users
Dato:  
Til: ros-users
Emne: [ros-users] [Discourse.ros.org] [Client Libraries] Python3 and strings


It also says :

- Primitive Type: string
- Serialization: ascii string (4)
- C++: std::string
- Python: **str**

and

- Primitive Type: uint8[]
- Serialization: uint32 length prefix
- C++: std::vector
- Python: **bytes**


Also in python3 both encoding and decoding are automatic, based on the platform you are running on, provided you use the right type (bytes or str).

If two platforms use different encodings for two nodes communicating, then messages will probably arrived garbled, if we intend to send a string.

On the other hand, if we do not send a string with an encoding, then we are sending **bytes**, just like for a `uint8[]` field.

- Is `string` the same as `uint8[]` ? (and Python type should be **bytes**)
- OR should ROS enforce some unicode encoding for string ? (and Python type can be **str**)

In any instance it seems the wiki page should separately list Python2 and Python3 to avoid confusion...





---
[Visit Topic](https://discourse.ros.org/t/python3-and-strings/2392/3) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>