diff --git a/libraries/ParserCSV.inc b/libraries/ParserCSV.inc
index e8cec48747f698a5a0f052b2dbb2764c2cf717de..085075373f6a34d3fa46fbfca654aa6041594361 100644
--- a/libraries/ParserCSV.inc
+++ b/libraries/ParserCSV.inc
@@ -214,7 +214,9 @@ class ParserCSV {
       $currentField = '';
       $fields = array();
 
-      while ($currentIndex <= drupal_strlen($line)) {
+      // We must use strlen() as we're parsing byte by byte using strpos(), so
+      // drupal_strlen() will not work properly.
+      while ($currentIndex <= strlen($line)) {
         if ($quoted) {
           $nextQuoteIndex = strpos($line, '"', $currentIndex);