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

2216Re: saving decoded unicode value to Session causes error

Expand Messages
  • Tsirkin Evgeny
    Aug 29 12:28 AM
    • 0 Attachment
      It looks like that SDBM_File file handler or something else in it's internals does not
      know that you are storing (writing) utf8 records into it.
      I don't know how to force it to know this :( maybe some SDBM_File expert here
      will know.
      However the workaround for this is to NOT mark the string you get as utf8 i.e.
      don't do Encode::decode_utf8. Just set your pages/server to send to the browser
      header saying that you need utf8 as request charset and you will be fine.

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      will do this or

      What this solution does NOT do - it does not validate the input to be legal utf8.
      But most of the time you will be fine.
      Hope this helps.

      On 8/29/07, Richard Yen <dba@...> wrote:

      Wondering if anyone has ever encountered this issue.

      Trying to internationalize my site, so at every input, I pass it
      through Encode::decode_utf8.

      However, when I attempt to put the values into Session, I get the
      following message:
      > Errors Output
      > Wide character in subroutine entry at /usr/local/perl/lib/site_perl/
      > 5.8.7/MLDBM/Sync/SDBM_File.pm line 80, <GEN10> line 21. , /usr/
      > local/perl/lib/site_perl/5.8.7/Apache/ASP.pm line 1521
      > Debug Output
      > Use of uninitialized value in string ne at ../global/lib/
      > lib_filesystem.pm line 41.
      > Using an array as a reference is deprecated at ../global/lib/
      > lib_peer_review.pm line 389, line 21.
      > Wide character in subroutine entry at /usr/local/perl/lib/site_perl/
      > 5.8.7/MLDBM/Sync/SDBM_File.pm line 80, line 21. , /usr/local/perl/
      > lib/site_perl/5.8.7/Apache/ASP.pm line 1521

      An example is if I use the capital Omega character (option-z on mac
      keyboard), this error occurs when attempting to store into Session:

      > my $secret_answer = Encode::decode_utf8($main::Request->Form
      > ('secret_answer'));
      > $main::Session->{secret_answer} = $secret_answer;

      I've discovered that if I put the decoded value into a hash, and then
      put the hash into Session, it behaves normally.  Also, if I don't
      decode at all, it behaves normally also.

      Would anyone know why this happens, or how to fix it?


      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...

    • Show all 4 messages in this topic