Special Characters are being Removed

Help
2008-09-26
2013-06-06
  • John Schattel

    John Schattel - 2008-09-26

    While going from PHP 5.2.5 to PHP 5.2.6, nusoap appears to be removing special characters like left and right angle brackets and quotes from the response document (see nusoap debug info below). Does anyone know why nusoap is removing HTML special characters and what can be done to turn this feature off?

    In advance, thanks.

    John

    2008-09-22 15:58:29.569114 soapclient: Got response encoding: ISO-8859-1
    2008-09-22 15:58:29.569289 soapclient: Use encoding: ISO-8859-1 when creating nusoap_parser
    2008-09-22 15:58:29.569471 nusoap_parser: Charset from HTTP Content-Type matches encoding from XML declaration
    2008-09-22 15:58:29.569545 nusoap_parser: Entering nusoap_parser(), length=4095, encoding=ISO-8859-1
    2008-09-22 15:58:29.570154 nusoap_parser: found root struct NDFDgenResponse, pos 2
    2008-09-22 15:58:29.571498 nusoap_parser: in buildVal() for NDFDgenResponse(pos 2) of type struct
    2008-09-22 15:58:29.571572 nusoap_parser: in buildVal, there are children
    2008-09-22 15:58:29.571651 nusoap_parser: in buildVal, adding Java Vector or generic compound type NDFDgenResponse
    2008-09-22 15:58:29.571736 nusoap_parser: in buildVal, return:
    array(1) {
    ["dwmlOut"]=>
    &string(2627) "?xml version=1.0?
    dwml version=1.0 xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd
    head
    product srsName=WGS 1984 concise-name=time-series operational-mode=official
    titleNOAAs National Weather Service Forecast Data/title
    fieldmeteorological/field
    categoryforecast/category
    creation-date refresh-frequency=PT1H2008-09-22T15:58:29Z/creation-date
    /product
    source
    more-informationhttp://www.nws.noaa.gov/forecasts/xml//more-information
    production-centerMeteorological Development Laboratorysub-centerProduct Generation Branch/sub-center/production-center
    disclaimerhttp://www.nws.noaa.gov/disclaimer.html/disclaimer
    credithttp://www.weather.gov//credit
    credit-logohttp://www.weather.gov/images/xml_logo.gif/credit-logo
    feedbackhttp://www.weather.gov/feedback.php/feedback
    /source
    /head
    data
    location
    location-keypoint1/location-key
    point latitude=38.99 longitude=-77.01/
    /location
    moreWeatherInformation applicable-location=point1http://forecast.weather.gov/MapClick.php?textField1=38.99amp;textField2=-77.01/moreWeatherInformation
    time-layout time-coordinate=local summarization=none
    layout-keyk-p24h-n7-1/layout-key
    start-valid-time2008-09-22T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-22T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-23T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-23T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-24T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-24T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-25T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-25T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-26T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-26T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-27T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-27T20:00:00-04:00/end-valid-time
    start-valid-time2008-09-28T08:00:00-04:00/start-valid-time
    end-valid-time2008-09-28T20:00:00-04:00/end-valid-time
    /time-layout
    parameters applicable-location=point1
    temperature type=maximum units=Fahrenheit time-layout=k-p24h-n7-1
    nameDaily Maximum Temperature/name
    value79/value
    value73/value
    value74/value
    value72/value
    value72/value
    value74/value
    value77/value
    /temperature
    /parameters
    /data
    /dwml
    "
    }
    2008-09-22 15:58:29.571887 nusoap_parser: parsed successfully, found root struct: 2 of name NDFDgenResponse

     
    • Josh Leroux

      Josh Leroux - 2008-09-29

      I'm having the same issue.  Just appeared recently.  As far as I can tell it's a problem with libxml2 (2.6.32) which I updated on Sept 10th to .  You can see the problem with this PHP code.  I'm using libxml2 (2.6.32) and PHP 5.2.6.

      $xml_parser = xml_parser_create();
      xml_parse_into_struct($xml_parser, "<SUMMARY>This is a link to &lt;a
      href=&quot;http://example.com&quot;&gt;Example&lt;/a&gt;.</SUMMARY>",
      $vals);
      xml_parser_free($xml_parser);
      echo "Vals array\n";
      print_r($vals);

      Results:

      Array
      (
          [0] => Array
              (
                  [tag] => SUMMARY
                  [type] => complete
                  [level] => 1
                  [value] => This is a link to a
      href=http://example.comExample/a.
              )

      )

      Notice the <>'s missing for 'value'.

       
    • Webago Ltd

      Webago Ltd - 2008-10-01

      We are having the same problem would like to see a solution to this soon

       
    • Andrew Swingler

      Andrew Swingler - 2008-11-20

      I'm seeing the same behaviour, but I don't agree that it's caused by PHP 5.2.6.

      I have a local installation that was running 5.2.5 on Apache/Windows. The local install was working correctly.
      I have a remote installation that is running 5.2.6 on Apache/CentOS.  The remote install was removing special chars.

      At this point the behaviour was identical to that described above.
      However, I updated my local installation to 5.2.6, and it continues to work correctly.
      So now I have a local Apache/Win 5.2.6 installation that works correctly, and a remote Apache/CentOS 5.2.6 installation that does not.

      The Apache versions are quite different (local is 2.2.10 and remote is 1.3.41) so there's a possibility that the old version of Apache is causing the problem.
      And of course there is the fact that one environment is Windows based and the other is Linux based.

      Hope this points someone in the right direction - so far we've been unable to resolve this issue, and it's holding up a rollout to our production environment.

      Andrew.

       
    • Andrew Swingler

      Andrew Swingler - 2008-11-21

      I have found a reason for this problem, and a (not pretty) workaround.

      This problem is being caused by problem with libxml2 (see this bug: http://bugs.php.net/bug.php?id=45996 ).

      Apparently, if you're running libxml2 with a version later than 2.6.32 you'll see this behaviour.

      This makes sense, as my local install is running 2.6.32 which works fine, while my remote install is running 2.7.2 and is broken.

      There are two possible workarounds:
      - Build PHP with a version of libxml2 <= 2.6.32
      - Build PHP using libexpat

      So, if you're running a 'bad' version of libxml2 the only known workarounds currently involve rebuilding PHP.

      Enjoy!

      Andrew.

       
  • dinesh

    dinesh - 2011-10-25

    just put following 3 lines

    $xml =str_replace(”&lt;”,”&#60;”,$xml );
    $xml =str_replace(”&gt;”,”&#62;”,$xml );
    $xml =str_replace(”&amp;”,”&#38;”,$xml );

    in function nusoap_parser before following line

    if(!xml_parse($this->parser,$xml,true)){ ……….

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks