Jump to content

escape illegal xml characters


simon551

Recommended Posts

Hi,

 

does anyone know of a good function to escape all illegal characters?

 

I've been writing a bunch of string_replace functions for each of my files and it is getting pretty tedious and I don't know if I am even catching all the possible (or even likely) problems

 

	$row['project'] = str_replace("&", "&", $row['project']);
$row['project'] = str_replace("<", "-", $row['project']);
$row['project'] = str_replace(">", "-", $row['project']);
$row['internalNote'] = str_replace("/", ".", $row['internalNote']);
$row['internalNote'] = str_replace("&", "&", $row['internalNote']);
$row['vendor'] = str_replace("&", "&", $row['vendor']);
$row['description'] = str_replace("&", "&", $row['description']);

Link to comment
https://forums.phpfreaks.com/topic/56448-escape-illegal-xml-characters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.