[wp-hackers] Entity fix
    Kimmo Suominen 
    kimmo+key+wordpress.c4f53f at suominen.com
       
    Wed Aug  3 18:31:02 GMT 2005
    
    
  
I was trying to use ½ and ¾ in a post, and they kept
getting mangled by WordPress.  The patch below fixes the problem.
I'd add this to Trac, but it appears TextDrive (or theplanet.com)
is having network problems, so I can't even reach my own sites
hosted at TextDrive.
Regards,
+ Kimmo
-- 
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>
Index: wp-includes/functions-formatting.php
===================================================================
--- wp-includes/functions-formatting.php	(revision 2674)
+++ wp-includes/functions-formatting.php	(working copy)
@@ -41,7 +41,7 @@
 		} else {
 			$next = true;
 		}
-		$curl = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $curl);
+		$curl = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $curl);
 		$output .= $curl;
 	}
 	return $output;
@@ -98,7 +98,7 @@
 
 function wp_specialchars( $text, $quotes = 0 ) {
 	// Like htmlspecialchars except don't double-encode HTML entities
-	$text = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $text);-
+	$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);
 	$text = str_replace('<', '<', $text);
 	$text = str_replace('>', '>', $text);
 	if ( $quotes ) {
@@ -345,7 +345,7 @@
 	$content = preg_replace('/<category>(.+?)<\/category>/','',$content);
 
 	// Converts lone & characters into & (a.k.a. &)
-	$content = preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $content);
+	$content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content);
 
 	// Fix Word pasting
 	$content = strtr($content, $wp_htmltranswinuni);
    
    
More information about the wp-hackers
mailing list