frost Posted March 30, 2009 Share Posted March 30, 2009 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! Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 They're 86 and 87, not 134 and 135. Quote Link to comment Share on other sites More sharing options...
frost Posted March 30, 2009 Author Share Posted March 30, 2009 Tried those but it says 134/135 here - http://ca2.php.net/chr Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 Oh strange. It does seem to be 134/135. Not sure why str_replace doesn't work then x.x. Can I see your code? Quote Link to comment Share on other sites More sharing options...
frost Posted March 30, 2009 Author Share Posted March 30, 2009 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. Quote Link to comment Share on other sites More sharing options...
frost Posted March 31, 2009 Author Share Posted March 31, 2009 I am putting the tring into a mysql database and it is converting the daggers to - ‡ Any idea why that would be? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 31, 2009 Share Posted March 31, 2009 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. Quote Link to comment Share on other sites More sharing options...
frost Posted March 31, 2009 Author Share Posted March 31, 2009 Can you recommend a hex editor? Cheers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.