Hi,

I have the following text in an RSS feed I'm trying to create:

"some text here"

How to I get rid of the  symbol??

Already tried to strip whitespace.

Thanks!!

    $string = str_replace(""", "", $string);

      Is, in fact, the """ (which is a perfectly valid XML character entity) what you want to get rid of, or are you talking about something else?

      PS: After looking at the thread title, I think all you need to do is use the [man]trim/man function, perhaps?

        Nope, sorry, ignore the " - if you look at this post in Explorer you should see a square character at the end of the code which replaces a carriage return that the user inputted - that's what I'm trying to get rid of. I've tried trim() but no joy.

        If you can't see it I can send a screenshot! ;-)

          Not sure, but might work

          $string=substr($string,0,length($string)-1);
          

          Perhaps you need to find the hex/ascii value of that symbol, then use "something" to remove that it when you search for the hex/ascii value. Dont know to much about this stuff, thats why its vague 😉

            How about something like this:

            $text = preg_replace( '/\p{Nl}/u', ' ', $text );
            

            or

            $text = preg_replace( '/\p{Me}/u', ' ', $text );
            

            do either of those work?

              Well, neither Firefox nor IE7 is showing any "square character" (or any other indication of a non-printable character). A screenshot won't really help, as it won't tell us what the non-printable character is.

              A link to the actual page would be the ideal way for us to help. If that's not possible for technical or privacy reasons, all I can think of is to make sure your <?xml declaration is including the correct encoding attribute and value for the text data which is being output.

                Thanks again - I've tried condoug's suggestions but no joy.

                Here's a link to a potion of the xml wher the strange character occurs (immediately after "Born of a Star")
                http://www.mogstarmedia.co.uk/error/feederror.zip (contains feederror.xml)
                or
                http://www.mogstarmedia.co.uk/error/feederror.xml

                This is not valid XML at the mo, just a portion of the file.

                This text was pasted into a CMS from Word and I believe that this was a return in Word.

                Thanks!

                  Looks to be ASCII code '9D' in hexadecimal, so try this:

                  $text = preg_replace('/\x9D/', '', $text);
                  

                    Thanks all, sorted! Much appreciated ;-)

                      Also note that there shouldn't be a need to use PCRE...

                      $text = str_replace("\x9D", '', $text);

                      Either way, don't forget to mark this thread resolved.

                        Write a Reply...