Jump to content

Problem with dagger and double dagger in a string.


frost

Recommended Posts

Hi,

 

I am having some trouble and I hope it is somthing obvious I have just missed:

 

I have a string that contains dagger and double dagger characters, here is a sample:

 

17‡48‡97‡3820‡FREE†

 

I am trying to run a str_replace on them as I understand they are bad characters to use - http://www.cs.tut.fi/~jkorpela/www/windows-chars.html

 

I have tried all kinds of things with no luck, changing the charset, trying to replace chr(134) chr(135) etc etc.

 

Any help would be apprectiated.

 

Cheers!

Link to comment
Share on other sites

The problem is that this is coming from a private XML feed that I can't share.

 

When I copy/paste some of the code to work on it seems to work just fine. For example:

 

<?

$str = "17‡48‡97‡3820‡FREE†";

 

$str = str_replace(chr(134), '**', $str);  // dagger (a second footnote)

$str = str_replace(chr(135), '***', $str);  // double dagger (a third footnote)

 

echo $str;

?>

 

This works!

 

But when I do this:

 

<?

$str = $pPGA_response;

 

$str = str_replace(chr(134), '**', $str);  // dagger (a second footnote)

$str = str_replace(chr(135), '***', $str);  // double dagger (a third footnote)

 

echo $str;

?>

 

It spits it out with the daggers intact.

 

 

 

Link to comment
Share on other sites

This is just a whim, but try 84/85 in that script, and see if it works.

 

 

If not, can you upload the part of the XML feed?  Or you could just do what I'm going to do and open it in a hex editor and see what values are at the dagger/double dagger.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.