Fix a bug in the CSV export DB utility

Reported via the forums: http://forum.codeigniter.com/thread-61810.html
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 57356ac..78398ea 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -249,7 +249,7 @@
 			$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
 		}
 
-		$out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+		$out = substr($out, 0, -strlen($delim)).$newline;
 
 		// Next blast through the result array and build out the rows
 		while ($row = $query->unbuffered_row('array'))
@@ -258,7 +258,7 @@
 			{
 				$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
 			}
-			$out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+			$out = substr($out, 0, -strlen($delim)).$newline;
 		}
 
 		return $out;
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 15be738..5c2c4d9 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -29,6 +29,7 @@
 -  Fixed a bug (#3823) - :doc:`Session Library <libraries/sessions>` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds.
 -  Fixed a bug (#3846) - :doc:`Image Manipulation Library <libraries/image_lib>` method `image_mirror_gd()` didn't properly initialize its variables.
 -  Fixed a bug (#3854) - `field_data()` didn't work properly with the Oracle (OCI8) database driver.
+-  Fixed a bug in the :doc:`Database Utility Class <database/utilities>` method ``csv_from_result()`` didn't work with a whitespace CSV delimiter.
 
 Version 3.0.0
 =============