Fix #133
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index c6d1478..bda8446 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -127,7 +127,7 @@
 	function ascii_to_entities($str)
 	{
 		$out = '';
-		for ($i = 0, $s = strlen($str), $count = 1, $temp = array(); $i < $s; $i++)
+		for ($i = 0, $s = strlen($str) - 1, $count = 1, $temp = array(); $i <= $s; $i++)
 		{
 			$ordinal = ord($str[$i]);
 
@@ -164,6 +164,11 @@
 					$count = 1;
 					$temp = array();
 				}
+				// If this is the last iteration, just output whatever we have
+				elseif ($i === $s)
+				{
+					$out .= '&#'.implode(';', $temp).';';
+				}
 			}
 		}