bug 563820: Fix for UTF8 detection in strings, including passwords, r=telliott
authorLeslie Michael Orchard <lorchard@mozilla.com>
Thu, 06 May 2010 15:49:17 -0400
changeset 85 24bba735d86d108c3365a6cdad1561b0d50d04b2
parent 84 19a7b85f7515ba025b9a837b2a1b1dd4e5628797
child 86 690076dcda52e7e5f1a0a8273eeee343e332dc9d
push id1
push usertziade@mozilla.com
push dateTue, 19 Oct 2010 10:41:37 +0000
reviewerstelliott
bugs563820
bug 563820: Fix for UTF8 detection in strings, including passwords, r=telliott
1.0/weave_utils.php
--- a/1.0/weave_utils.php
+++ b/1.0/weave_utils.php
@@ -19,17 +19,17 @@
 		}
 		
 		exit(json_encode($message));
 	}
 	
 	
 	function fix_utf8_encoding($string)
 	{
-		if(mb_detect_encoding($string) == 'UTF-8')
+		if(mb_detect_encoding($string, 'UTF-8,ISO-8859-1') == 'UTF-8')
 			return $string;
 		else
 			return utf8_encode($string);
 	}
 
 	function get_json()
 	{
 		#stupid php being helpful with input data...
@@ -209,9 +209,9 @@
 	function get_source_ip()
 	{
 		if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER))
 			return $_SERVER['HTTP_X_FORWARDED_FOR'];
 		return $_SERVER['REMOTE_ADDR'];
 	
 	}
 	
-?>
\ No newline at end of file
+?>