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

mod_soap and iso-8859-1

Expand Messages
  • Bengt Nilsson
    Hi, I have a mod_soap based server and want to return an iso-8859-1 string. How do I do that? /Regards Bengt
    Message 1 of 5 , Aug 21, 2001
    • 0 Attachment
      Hi,

      I have a mod_soap based server and want to return an iso-8859-1 string. How do I do that?

      /Regards Bengt
    • Paul Kulchenko
      Hi, Bengt! ... If you just have a iso-8859-1 string, you may encode it as utf8, using pack for 5.8, tr// for 5.6, or Unicode::String for older versions. If you
      Message 2 of 5 , Aug 21, 2001
      • 0 Attachment
        Hi, Bengt!

        > I have a mod_soap based server and want to return an iso-8859-1
        > string. How do I do that?
        If you just have a iso-8859-1 string, you may encode it as utf8,
        using pack for 5.8, tr// for 5.6, or Unicode::String for older
        versions. If you need to specify iso-8859-1 as an encoding for your
        response, then you need to use 'encoding' option in serializer. You
        don't have direct access to it through SetVar, but you should be able
        to do it with <Perl> section. Something like this may work:

        <Perl>

        use Apache::SOAP;
        my $server = Apache::SOAP
        -> dispatch_to('...');
        $server->serializer->encoding('iso-8859-1');
        $Location{'/perl_soap'} = {
        SetHandler => 'perl-script',
        PerlHandler => $server,
        };

        </Perl>

        Let me know if it doesn't (or does) work for you.

        Best wishes, Paul.

        --- Bengt Nilsson <bengt.nilsson@...> wrote:
        > Hi,
        >
        > I have a mod_soap based server and want to return an iso-8859-1
        > string. How do I do that?
        >
        > /Regards Bengt
        >
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Make international calls for as low as $.04/minute with Yahoo! Messenger
        http://phonecard.yahoo.com/
      • Andrew Hicox
        Hello everyone: I ve got a service running on a mod_soap (Apache::SOAP) service, that takes some user input and puts it in a database. When users would enter
        Message 3 of 5 , Jul 28 12:30 PM
        • 0 Attachment
          Hello everyone:

          I've got a service running on a mod_soap (Apache::SOAP) service, that
          takes some user input and puts it in a database. When users would
          enter international characters, the method would bomb with errors of
          this type:

          "not well-formed (invalid token) at line ..."

          I fixed this in the client by specifying iso-8859-1 encoding on the
          soap object before sending the call to the method on the server.
          Everything seems okay with that.

          I also have a separate method on the same soap server which reutrns
          text out of the database. When a user selects a record containing
          international characters, the method again dies with the invalid token
          error.

          I presume I need to find a way to iso-8859-1 encode the response from
          the server. I cannot seem to find any documentation on how to do this,
          apart from this very old messaage:

          http://groups.yahoo.com/group/soaplite/message/779

          I cannot make the method described in that message work, because I
          cannot find a way to make apache recognize the '/perl_soap' location.

          $Location{...} does not seem to actually DO anything.

          there has to be a better way than this, I would think.

          what am I doing wrong?

          -Andrew
        • cedric.boufflers
          Hello Andrew, On my PERL WebService (Perl 5.8) I do something similar to the following code before to return strings: use Encode; my $value = encode( UTF-8 ,
          Message 4 of 5 , Jul 29 12:20 AM
          • 0 Attachment
            Hello Andrew,

            On my PERL WebService (Perl 5.8) I do something similar to the following
            code before to return strings:

            use Encode;

            my $value = encode("UTF-8", $latin1string);
            return SOAP::Data->type( 'string' )->name( 'result' => $value );

            Thus I attempt to encode everything UTF-8 because SOAP::Lite is UTF-8
            native as well as PERL. Although this method seems to work well with
            cgi-bin but not quite well with mod_perl, but I think it is more related
            to our server and mod_perl configuration so it might work well in both
            case for you.

            If this doesn't work, you might also want to look at the documentation
            for this module :
            Encode::Encoder
            Encode::Guess

            They might help you :-)

            If you find other interesting things on how to deal with encoding and
            SOAP, then I'd be glad if you could share it with me as well, because I
            still have some issues with encoding :-(

            Best Regards,
            Cédric


            Andrew Hicox a écrit :

            >Hello everyone:
            >
            >I've got a service running on a mod_soap (Apache::SOAP) service, that
            >takes some user input and puts it in a database. When users would
            >enter international characters, the method would bomb with errors of
            >this type:
            >
            >"not well-formed (invalid token) at line ..."
            >
            >I fixed this in the client by specifying iso-8859-1 encoding on the
            >soap object before sending the call to the method on the server.
            >Everything seems okay with that.
            >
            >I also have a separate method on the same soap server which reutrns
            >text out of the database. When a user selects a record containing
            >international characters, the method again dies with the invalid token
            >error.
            >
            >I presume I need to find a way to iso-8859-1 encode the response from
            >the server. I cannot seem to find any documentation on how to do this,
            >apart from this very old messaage:
            >
            >http://groups.yahoo.com/group/soaplite/message/779
            >
            >I cannot make the method described in that message work, because I
            >cannot find a way to make apache recognize the '/perl_soap' location.
            >
            >$Location{...} does not seem to actually DO anything.
            >
            >there has to be a better way than this, I would think.
            >
            >what am I doing wrong?
            >
            >-Andrew
            >
            >
            >
            >
            >
            >Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >


            --
            ---------------------------------------------------------------------
            BOUFFLERS Cédric : cedric.boufflers@...
            ---------------------------------------------------------------------
            NordNet - 111 Rue de Croix - 59510 Hem - France
            tél : +33 3 20 66 55 55 - fax : +33 3 20 66 55 59
            ---------------------------------------------------------------------
            http://www.securitoo.com/
            http://www.nordnet.fr/
            http://www.lerelaisinternet.com/
            ---------------------------------------------------------------------
          • Brad Miele
            I discovered the same issue with mod_perl and Encode, and so I just do this to strings before i send them out: $stringtoclean =~ s/([^ x00- x7F])/ &# .
            Message 5 of 5 , Aug 2, 2005
            • 0 Attachment
              I discovered the same issue with mod_perl and Encode, and so I just do this to strings before i send them out:

              $stringtoclean =~ s/([^\x00-\x7F])/'&#' . ord($1) . ';'/gse;

              I am sure that this is a bad idea for some reason or other, but it has ensured that everything is UTF8 friendly for both mod_perl and cgi.

              On 7/29/05, cedric.boufflers <cedric.boufflers@... > wrote:
              Hello Andrew,

              On my PERL WebService (Perl 5.8) I do something similar to the following
              code before to return strings:

              use Encode;

              my $value = encode("UTF-8", $latin1string);
              return SOAP::Data->type( 'string' )->name( 'result' => $value );

              Thus I attempt to encode everything UTF-8 because SOAP::Lite is UTF-8
              native as well as PERL. Although this method seems to work well with
              cgi-bin but not quite well with mod_perl, but I think it is more related
              to our server and mod_perl configuration so it might work well in both
              case for you.

              If this doesn't work, you might also want to look at the documentation
              for this module :
              Encode::Encoder
              Encode::Guess

              They might help you :-)

              If you find other interesting things on how to deal with encoding and
              SOAP, then I'd be glad if you could share it with me as well, because I
              still have some issues with encoding :-(

              Best Regards,
              Cédric


              Andrew Hicox a écrit :

              >Hello everyone:
              >
              >I've got a service running on a mod_soap (Apache::SOAP) service, that
              >takes some user input and puts it in a database. When users would
              >enter international characters, the method would bomb with errors of
              >this type:
              >
              >"not well-formed (invalid token) at line ..."
              >
              >I fixed this in the client by specifying iso-8859-1 encoding on the
              >soap object before sending the call to the method on the server.
              >Everything seems okay with that.
              >
              >I also have a separate method on the same soap server which reutrns
              >text out of the database. When a user selects a record containing
              >international characters, the method again dies with the invalid token
              >error.
              >
              >I presume I need to find a way to iso-8859-1 encode the response from
              >the server. I cannot seem to find any documentation on how to do this,
              >apart from this very old messaage:
              >
              >http://groups.yahoo.com/group/soaplite/message/779
              >
              >I cannot make the method described in that message work, because I
              >cannot find a way to make apache recognize the '/perl_soap' location.
              >
              >$Location{...} does not seem to actually DO anything.
              >
              >there has to be a better way than this, I would think.
              >
              >what am I doing wrong?
              >
              >-Andrew
              >
              >
              >
              >
              >
              >Yahoo! Groups Links
              >
              >
              >
              >
              >
              >
              >
              >

              >


              --
              ---------------------------------------------------------------------
              BOUFFLERS Cédric : cedric.boufflers@...
              ---------------------------------------------------------------------
              NordNet - 111 Rue de Croix - 59510 Hem - France
              tél : +33 3 20 66 55 55 - fax : +33 3 20 66 55 59
              ---------------------------------------------------------------------
              http://www.securitoo.com/
              http://www.nordnet.fr/
              http://www.lerelaisinternet.com/
              ---------------------------------------------------------------------



              YAHOO! GROUPS LINKS






              --
              Brad Miele                                                                                                                        
              Technology Director                                                                                                                
              IPNStock                                                                                                                          
              (866) 476-7862 x902                                                                                                                
              bmiele@...
            Your message has been successfully submitted and would be delivered to recipients shortly.