rewriting for encoding way and fix cppcommon/str_functs.cpp's bug