Index: branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 3709)
+++ branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 3722)
@@ -3426,5 +3426,5 @@
 					imap_reopen($mbox_stream, "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$name_box);
 
-                                if (preg_match("/^.?\bALL\b/", $filter)){ // Quick Search, note: this ALL isn't the same ALL from imap_search
+                if (preg_match("/^.?\bALL\b/", $filter)){ // Quick Search, note: this ALL isn't the same ALL from imap_search
 
 					$all_criterias = array ("TO","SUBJECT","FROM","CC");
@@ -3439,15 +3439,15 @@
 						{
 							foreach($search_criteria as $new_search){
-                                                                if ($search_result_number != '65536' && $sum == $search_result_number)
-                                                                {
-                                                                  return $retorno ? $sum . "=sumResults=" . $retorno : "none";
-                                                                }
+                                if ($search_result_number != '65536' && $sum == $search_result_number)
+                                {
+                                  return $retorno ? $sum . "=sumResults=" . $retorno : "none";
+                                }
 
 								$m_token = trim("##". mb_convert_encoding( $folder_name, "ISO_8859-1", "UTF7-IMAP" ) . "--" . mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n");
 								if(!@strstr($retorno,$m_token))
-                                                                {
-                                                                    $retorno .= $m_token;
-                                                                    $sum++;
-                                                                }
+                                {
+                                    $retorno .= $m_token;
+                                    $sum++;
+                                }
 							}
 						}
@@ -3540,5 +3540,5 @@
 		if($header->from[0]->personal != "")
 			$from = $header->from[0]->personal;
-		$ret_msg = $this->decode_string($from) . "--" . $subject . "--". gmdate("d/m/Y",$header ->udate + $this->functions->CalculateDateOffset())."--". $this->size_msg($header->Size) ."--". $flag;
+		$ret_msg = $this->decode_string($from) . "--" . htmlentities(rawurlencode($subject)) . "--". gmdate("d/m/Y",$header ->udate + $this->functions->CalculateDateOffset())."--". $this->size_msg($header->Size) ."--". $flag;
 		return $ret_msg;
 	}
Index: branches/2.2/expressoMail1_2/js/search.js
===================================================================
--- branches/2.2/expressoMail1_2/js/search.js	(revision 3711)
+++ branches/2.2/expressoMail1_2/js/search.js	(revision 3722)
@@ -427,29 +427,28 @@
 			var tr = document.createElement("TR");
 				tr.style.height = preferences.line_height;
-
-			if (false && nw_array[i].match(/.*--.*--\w*--\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g) != null) //subject with "--"
-			{
-				var aux1 = nw_array[i].match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g);
-					aux1 = aux1[0].split("--");
-				nw_array[i] = nw_array[i].substr(0, nw_array[i].indexOf(aux1[0])-2);
-				
-				var aux 	= [];
-				
-				aux[0]	= nw_array[i].substr(0, nw_array[i].indexOf('--'));
-				nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
-				aux[3] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
-				nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
-				aux[1] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
-				aux[2] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
-				aux = aux.concat(aux1);
-			}
-			else
-			{
-				var aux = nw_array[i].split("--");
-				aux.splice(4,0,aux[1]);
-				var mailbox = aux.shift();
-				aux.splice(0,1,mailbox);
-			}
-
+			nw_array[i] = url_decode(unescape(nw_array[i]));
+			
+			var aux1;
+			aux1 = nw_array[i].match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g);
+			/*
+			 * E-mails do dia estão vindo com o horário em mensagens locais. 
+			 * Caso isso seja "corrigido" essa condicional não será mais necessária
+			 */
+			if(aux1==null) 
+				aux1 = nw_array[i].match(/\d{2}:\d{2}--\d+? \w*b--.*--\d*$/g);
+			aux1 = aux1[0].split("--");
+			nw_array[i] = nw_array[i].substr(0, nw_array[i].indexOf(aux1[0])-2);
+			
+			var aux 	= [];
+			var mailbox = "";
+			aux[0] = mailbox = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+			nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
+			aux[3] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+			nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
+			aux[1] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+			aux[2] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
+			aux = aux.concat(aux1);
+
+			
 			var mailbox_name = aux[0];
 			var mailbox_id = aux[3];
@@ -529,5 +528,5 @@
 					{
 						var td1 = this.aux_local_folder_display(td1);
-						aux[2] = tr.name = aux[0]; // precisa trocar pelo nome real no banco do gears.
+						tr.name = aux[0]; // precisa trocar pelo nome real no banco do gears.
 					}
 					else
Index: branches/2.2/expressoMail1_2/js/local_messages.js
===================================================================
--- branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3716)
+++ branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3722)
@@ -967,7 +967,13 @@
     var retorno = "";
     while(rs.isValidRow()) {
-	var header = connector.unserialize(rs.field(0));
-	retorno+="##"+"local_"+rs.field(1)+"--"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+header["subject"]+"--"+header["udate"]+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##";
-	rs.next();
+		var header = connector.unserialize(rs.field(0));
+		var date_formated = ""+header["udate"];
+		/* Antigamente o udate vinha com o formato de data e foi alterado para vir o timestamp. 
+		 * Nesse caso, e-mails arquivados anteriormente usamos o udate, caso contrario, usamos o smalldate,
+		 * pois o udate agora vem como timestamp*/
+		if(!date_formated.match(/\d{2}\/\d{2}\/\d{4}/)) 
+			date_formated = header["smalldate"];
+		retorno+="##"+"local_"+rs.field(1)+"--"+"local_"+rs.field(1)+"--"+header["from"]["name"]+"--"+escape(header["subject"])+"--"+date_formated+"--"+this.aux_convert_size(rs.field(3))+"--"+header["Unseen"]+header["Recent"]+header["Flagged"]+header["Draft"]+"--"+rs.field(2)+"##";
+		rs.next();
     }
 
