On Aug 29, 2007, at 12:28 AM, Tsirkin Evgeny wrote:

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.
Hmm, I thought that perhaps it was something with Apache::ASP, and that SDBM_File would be a dependency that was being passed bad data?

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
$Response->AddHeader()
I suppose I misunderstood the purpose of this <meta> tag...so not only output, but inputs get encoded as UTF-8 here? Cool stuff.... When, then, would I need to use decode_utf8? I suppose it's for file- reading or command-line input then?

What this solution does NOT do - it does not validate the input to be legal utf8.
True.  Will keep that in mind.

But most of the time you will be fine.
Hope this helps.
Evgeny
Thanks!
--Richard





On 8/29/07, Richard Yen <[EMAIL PROTECTED]> wrote: Hi,

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?

Thanks!
--Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to