Turning HTML character entities to 'regular' letters... why is it only partially working?
        Posted  
        
            by Jack W-H
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jack W-H
        
        
        
        Published on 2010-03-01T21:55:48Z
        Indexed on 
            2010/03/16
            21:01 UTC
        
        
        Read the original article
        Hit count: 459
        
I'm using all of the below to take a field called 'code' from my database, get rid of all the HTML entities, and print it 'as usual' to the site:
   <?php $code = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $code);
   $code = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $code); 
   $code = html_entity_decode($code); ?>
However the exported code still looks like this:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’img/the_image.png’);
See what's going on there? How many other things can I run on the string to turn them into darn regular characters?!
Thanks!
Jack
© Stack Overflow or respective owner