Merge pull request #4896 from sportica/mac_fix_space
authorjmarshallnz <jcmarsha@gmail.com>
Thu, 17 Jul 2014 20:21:25 +0000 (08:21 +1200)
committerJonathan Marshall <jmarshall@xbmc.org>
Sat, 19 Jul 2014 05:20:34 +0000 (17:20 +1200)
Some character disappear on mac os x

xbmc/utils/StringUtils.cpp

index 35ee0cc..ac1beea 100644 (file)
@@ -443,11 +443,11 @@ std::string& StringUtils::Trim(std::string &str, const char* const chars)
   return TrimRight(str, chars);
 }
 
-// hack to ensure that std::string::iterator will be dereferenced as _unsigned_ char
-// without this hack "TrimX" functions failed on Win32 with UTF-8 strings
+// hack to check only first byte of UTF-8 character
+// without this hack "TrimX" functions failed on Win32 and OS X with UTF-8 strings
 static int isspace_c(char c)
 {
-  return ::isspace((unsigned char)c);
+  return (c & 0x80) == 0 && ::isspace(c);
 }
 
 std::string& StringUtils::TrimLeft(std::string &str)