Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Encoding text from server

Expand Messages
  • Hugues de Mazancourt
    ... There s a *real* problem with the way Perl handles UFT-8 strings (or what it this is Unicode strings). You can t really predict what will happen to
    Message 1 of 5 , Aug 31, 2007
    • 0 Attachment

      Le 31 août 07 à 02:04, Morgan Fletcher a écrit :

      I am querying a service like so:

      $response = SOAP::Lite
      ->service("http://thing1. thing2.com: 10000/FOO. wsdl ")
      -> getId("$r");

      Some of the records I get contain characters like this: \205 \256. 
      (represented as best I can) When I get a record like that I get:

      There's a *real* problem with the way Perl handles UFT-8 strings (or what it this is Unicode strings). You can't really predict what will happen to non-ASCII data when different packages, layers, system variables (such as LANG) are involved.
      My solution to these problems was to Base64-encode/decode all data before sending them over the network.
      See MIME::Base64 package

      Best,

      Hugues

    • Morgan Fletcher
      ... Did you encode them on the server side? I can t modify what comes from the web service, it s vendor-provided. Morgan
      Message 2 of 5 , Aug 31, 2007
      • 0 Attachment
        Hugues de Mazancourt wrote:
        >
        > Le 31 août 07 à 02:04, Morgan Fletcher a écrit :
        >
        >> I am querying a service like so:
        >>
        >> $response = SOAP::Lite
        >> ->service("http://thing1.thing2.com:10000/FOO.wsdl
        >> <http://thing1.thing2.com:10000/FOO.wsdl>")
        >> -> getId("$r");
        >>
        >> Some of the records I get contain characters like this: \205 \256.
        >> (represented as best I can) When I get a record like that I get:
        >
        > There's a *real* problem with the way Perl handles UFT-8 strings (or
        > what it this is Unicode strings). You can't really predict what will
        > happen to non-ASCII data when different packages, layers, system
        > variables (such as LANG) are involved.
        > My solution to these problems was to Base64-encode/decode all data
        > before sending them over the network.
        > See MIME::Base64 package

        Did you encode them on the server side? I can't modify what comes from
        the web service, it's vendor-provided.

        Morgan
      • Hugues de Mazancourt
        ... Fortunately (for me), I m on the server side. I don t know if there s any way to trap the message before it is passed to the XML parser. I guess it would
        Message 3 of 5 , Aug 31, 2007
        • 0 Attachment

          Le 31 août 07 à 17:21, Morgan Fletcher a écrit :

          Did you encode them on the server side? I can't modify what comes from 
          the web service, it's vendor-provided.

          Fortunately (for me), I'm on the server side.
          I don't know if there's any way to trap the message before it is passed to the XML parser. I guess it would be a solution.


          Hugues
        • Morgan Fletcher
          ... Replying to myself; the vendor fixed this on the server side. Thanks for the feedback. Morgan
          Message 4 of 5 , Sep 4, 2007
          • 0 Attachment
            Morgan Fletcher wrote:
            > I am querying a service like so:
            >
            > $response = SOAP::Lite
            > ->service("http://thing1.thing2.com:10000/FOO.wsdl
            > <http://thing1.thing2.com:10000/FOO.wsdl>")
            > -> getId("$r");
            >
            > Some of the records I get contain characters like this: \205 \256.
            > (represented as best I can) When I get a record like that I get:
            >
            > not well-formed (invalid token) at line 44, column 106, byte 2658 at
            > /usr/lib/perl5/
            >
            > vendor_perl/5.8.5/i386-linux-thread-multi/XML/Parser.pm
            > line 187
            >
            > Should I be encoding this text somehow, from the client end, so that I
            > don't get this XML Parser error? If so, how?
            >

            Replying to myself; the vendor fixed this on the server side.

            Thanks for the feedback.

            Morgan
          Your message has been successfully submitted and would be delivered to recipients shortly.