PDA

View Full Version : in a variable



coops2000
10-05-2007, 12:53 PM
HI,
I'm doing a simple function retrieve data and export the data into xml, but found out xml does not like all character. The character I have found are '&','','<','>',''. So I have developed a simple function that will replace curtain character within a string with the HTML code that XML likes. '&#38;','&#172;','&#60;','&#62;','&#163;'
It seems to work with all character, but apart from "" sign. The only reason is because if i use the below code


while($i < strlen($value)){
$ia=0;
$sign = $value{$i};

while($ia < count($strarValidation)){

if($strarValidation[$ia] == $sign){

$sign = $strarNewChar[$ia];
break;
}
$ia++;
}

$endValue.= $sign;

The value at
$sign = $value{$i}; for a is the HTML code, not "". So the function can't be used...

Does anyone else know of a way that I can stop the "" converting to the html code when converting the string variable into a array?

Thanks

Twey
10-05-2007, 02:28 PM
You're using the wrong character encoding. Switch to UTF-8. Also, PHP by default doesn't like multi-byte encodings very much; make sure you're using the mbstring with function overloading turned on.