Robotics StackExchange | Archived questions

does ROS_INFO support utf8 string?

I'm Chinese. So I want to print some Chinese info, like:

ROS_INFO ("调试信息");

but all I got is:

[ INFO] [1415863087.967254365]: ????????????

(by the way, printf goes well)

I save the cpp source file in utf8 format.

so, does ROS_INFO support utf8 string ?

thanks!

Asked by rubick on 2014-11-13 02:47:44 UTC

Comments

any body know about it ?

Asked by rubick on 2014-11-25 00:55:49 UTC

Buddy. Have you sovled this problem?

Asked by Vance.fzu on 2017-07-31 22:52:32 UTC

Answers

I found this link and helped me : Link in portuguese.

This command takes the encoding of the machine running the program.

Add include locale in your code:

#include <locale.h>
#include "ros/ros.h"

 int main(int argc, char **argv) {
     setlocale( LC_ALL, "" ); 
     ROS_INFO ("调试信息");
}

Asked by Diogo42 on 2020-01-21 07:43:50 UTC

Comments