Browse Source

Feature #272 - Internationalization library: Correction in the function api_fgetcsv(), removing "\r" or "\n" characters at the end of the processed line.

Ivan Tcholakov 15 years ago
parent
commit
55aa7d719e
1 changed files with 1 additions and 0 deletions
  1. 1 0
      main/inc/lib/internationalization.lib.php

+ 1 - 0
main/inc/lib/internationalization.lib.php

@@ -3812,6 +3812,7 @@ function & api_str_getcsv(& $string, $delimiter = ',', $enclosure = '"', $escape
  */
 function api_fgetcsv($handle, $length = null, $delimiter = ',', $enclosure = '"', $escape = '\\') {
 	if (($line = is_null($length) ? fgets($handle): fgets($handle, $length)) !== false) {
+		$line = rtrim($line, "\r\n");
 		return api_str_getcsv($line, $delimiter, $enclosure, $escape);
 	}
 	return false;