I have both english and persian texts in my cocos2d-x (some things cannot be translated).
But the std::string trim(std::string rawText) method is failing when executed with one single english character. For example: "M" becomes "".
I replaced the trim method with the following:
string whitespace = " ";
const auto strBegin = str.find_first_not_of(whitespace);
if (strBegin == std::string::npos)
return ""; // no content
const auto strEnd = str.find_last_not_of(whitespace);
const auto strRange = strEnd - strBegin + 1;
return str.substr(strBegin, strRange);
But not sure if I'm breaking something with UTF8 persian chars.
I have both english and persian texts in my cocos2d-x (some things cannot be translated). But the std::string trim(std::string rawText) method is failing when executed with one single english character. For example: "M" becomes "". I replaced the trim method with the following:
But not sure if I'm breaking something with UTF8 persian chars.