Closed DinnerHowe closed 5 years ago
maybe we need to use std::wstring
in the API?
yes, i think so. also, i tried input a wstring to ROS_INFO, it cannot pass catkin make yet:
std::wstring aa;
aa = "我是新手";
ROS_INFO(aa);
the error is
error: invalid conversion from ‘const char*’ to ‘wchar_t’ [-fpermissive]
Anyone knows solution ?
I just added a small test case in console_bridge to print Chinese characters, and it appears to work for me: https://github.com/scpeters/console_bridge/commit/2c95bdd6f335178d960603fdd0116ecf685978d8
Perhaps the problem is farther downstream in ROS?
rosout
sends the logs as an ascii string in the topics, see:
I do not believe this can be fixed because ROS 1's type system doesn't support wide strings.
Will support them in ROS 2 though, so maybe we should put that (should support unicode messages) as input to the ongoing work for the logging subsystem in ROS 2:
thanks @wjwwood
I added a comment that we should support this in ros2
I will close this issue since it is not a problem with console_bridge
hi, there: We found ROS cannot print Chinese by c++, like" 我是新手 ". For instance, ROS_INFO(" 我是新手 "), the result is [ INFO] [1512552131.271037807]: ???????????? However, in python ROS could print Chinese well. Is this issue caused by pointer? like: const char m in void console_bridge::log(const char file, int line, LogLevel level, const char* m, ...) @wjwwood