[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


Interestingly, from this code, I understand the exact opposite of

> unicode strings are currently not supported



We are obviously using unicode codec `UTF-8` to encode and decode it, and the matching python type is a [unicode string](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str). So looking at this code, I would say :
' A `string` field in a ROS message is a unicode string, and will be encoded/decoded using UTF-8 for serialization/deserialization'

And in that case the wiki should state :

- Primitive Type: string
- Serialization: **utf-8** string (4)
- C++: std::string
- Python3: str
- Python2: **unicode**

**_On the other hand_**, if this is not true and the ROS serialization is only supporting ASCII, then the python matching type should be bytes, and the wiki should say :

- Primitive Type: string
- Serialization: ascii string (4)
- C++: std::string
- Python3: **bytes**
- Python2: str

and the serialization code needs to be fixed ( no need to encode/decode, unicode is not supported ).





---
[Visit Topic](https://discourse.ros.org/t/python3-and-strings/2392/5) 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>