Re: [PHP] One more data formatting question [SOLVED]



Hi:

Thanks for the answer! That worked exactly as I needed it to work!

Jon

----- Original Message -----
From: "T.Lensselink" <dev@xxxxxxxx>
To: "Jon Westcot" <jon@xxxxxxxxxxx>
Cc: "PHP General" <php-general@xxxxxxxxxxxxx>
Sent: Thursday, November 29, 2007 8:17 AM
Subject: Re: [PHP] One more data formatting question


On Thu, 29 Nov 2007 07:53:56 -0700, "Jon Westcot" <jon@xxxxxxxxxxx> wrote:
Hi all:

I'm trying to parse out some HTML code back into "regular" string
values and I keep getting tripped up by the non-breaking space value
( ). I see that html_decode_entities() can be used to convert this
back to a viewable space, but the documentation tells me that the space
value it uses is not the same as a TRIMable space (i.e., ASCII 32).

Is there a quick, fast, and easily implemented way to convert any
non-breaking space found in a string back to the ASCII 32 space value? I
suspect that one of those amazing POSIX expressions could do it, but I'm
having trouble wrapping my head around them at this early hour.

Any help you all can provide will be extremely appreciated!

Thanks,

Jon

str_replace should do the trick.

str_replace('&nbsp;', chr(32), $string);
or
str_replace('&nbsp;', ' ', $string);
.



Relevant Pages

  • Re: [PHP] One more data formatting question
    ... I'm trying to parse out some HTML code back into "regular" string ... non-breaking space found in a string back to the ASCII 32 space value? ...
    (php.general)
  • Deutsch nach ASCII konvertieren
    ... "ascii", $string, sub { ... also das to_ascii offenbar einen Latin-1-kodierten String will. ... Gefunden habe ich weiterhin eine kleine Sub, die die Ersetzung ... Ähnlich wie bei Variante 1 wird hier die Menge der Ersetzungs-Regexen ...
    (de.comp.lang.perl.misc)
  • UnicodeEncodeError in Windows
    ... def getdamage: ... """reads each line of war report ... """Build a string from a warrior's stats ... As I understand it the error is related to the ascii codec being ...
    (comp.lang.python)
  • Best integer to string routines
    ... ASCII string, it can be in any format - zero-terminated, leading ... Convert byte value to ASCII hex string ... Convert byte value to ASCII decimal string ...
    (alt.lang.asm)
  • Re: Writing extended ascii characters to text file.
    ... so in order to get real ASCII codes you should use the GetBytes ... method of an Encoding instance configured for the ASCII encoding (as far as ... again, you've got bytes, not characters. ... > string line; ...
    (microsoft.public.dotnet.languages.csharp)