From: <ag...@us...> - 2011-12-06 00:44:40
|
Revision: 2635 http://zoolib.svn.sourceforge.net/zoolib/?rev=2635&view=rev Author: agreen Date: 2011-12-06 00:44:34 +0000 (Tue, 06 Dec 2011) Log Message: ----------- Handle ZWNBSP (byte-order mark) better. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZUtil_Strim.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Strim.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Strim.cpp 2011-12-03 23:40:11 UTC (rev 2634) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Strim.cpp 2011-12-06 00:44:34 UTC (rev 2635) @@ -38,6 +38,17 @@ #pragma mark - #pragma mark * ZUtil_Strim +static bool spIsWhitespace(UTF32 iCP) + { + if (ZUnicode::sIsWhitespace(iCP)) + return true; + + if (iCP == 0xFEFF) + return true; + + return false; + } + bool sTryRead_CP(const ZStrimU& iStrimU, UTF32 iCP) { // Ensure that we only try to read a valid CP, one that @@ -383,7 +394,7 @@ UTF32 theCP; if (not iStrimU.ReadCP(theCP)) break; - if (not ZUnicode::sIsWhitespace(theCP)) + if (not spIsWhitespace(theCP)) { iStrimU.Unread(theCP); break; @@ -399,7 +410,7 @@ UTF32 theCP; if (not iStrimU.ReadCP(theCP)) break; - if (not ZUnicode::sIsWhitespace(theCP)) + if (not spIsWhitespace(theCP)) { iStrimU.Unread(theCP); break; @@ -418,7 +429,7 @@ UTF32 firstCP; if (iStrimU.ReadCP(firstCP)) { - if (ZUnicode::sIsWhitespace(firstCP)) + if (spIsWhitespace(firstCP)) { oDest.WriteCP(firstCP); continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |