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

Re: [soaplite] Sending Unicode strings

Expand Messages
  • rahed
    ... Have you tried to encode a Perl string into octets like this? use Encode; $string = Encode::encode( utf8 ,$string) This will encode perl characters into
    Message 1 of 2 , May 16, 2010
    • 0 Attachment
      "andrew.smith@..." <andrewsmith_97@...> writes:

      > but I cannot seem to figure out my problem. Basically, I want to send unicode strings, e.g. like "...EBP\x{3b1}-ER..." (and this unicode string was something I actually received back in a Soap response). When I just send them directly, they get base 64 encoded. However, when I try to explicitly set their type to string as is recommended, i.e.
      >
      > $string_val = SOAP::Data->type(string => $unicode_val);
      >
      > then I get the error:
      >
      > HTTP::Message content must be bytes at /apps/sys/lib/perl5/site_perl/5.10.0/SOAP/Transport/HTTP.pm line 204
      >
      > How can I send such Unicode strings? I'm using the latest version of SOAP::Lite.
      >

      Have you tried to encode a Perl string into octets like this?

      use Encode;
      $string = Encode::encode('utf8',$string)

      This will encode perl characters into octets for external
      application.

      Encode::decode function will decode octets into Perl chars.

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