I can confirm that it's happening before the data's gone to the
database or anything.

I'm getting the params from CGI.pm and then decoding via decode("utf8", $v)

The page the params came from is set as utf-8 in the http header and
content type and firefox is believing the page is utf-8.

It looks as though the browser isn't sending the data as UTF-8 unless
it contains text that has to be. As soon as I add a € or some other
character that's utf-8 it comes through fine.

Checking the params before it's decoded showed the £ as I expected to
see it after if had been decoded leading me to think the form hasn't
been passed as utf-8 .

Any clues..... anyone?


On 5/18/05, angie ahl <[EMAIL PROTECTED]> wrote:
> Hi List
> 
> I've been pottering away trying to get utf-8 behaving on my set up and
> have nearly got there but then the client phoned up saying that the £
> symbol was being displayed as a ?
> 
> The first page contains several languages and a £ sign and all is
> displayed fine.
> 
> http://perl.wtsbroadcast.com/about/Angies_test_page.html
> 
> The second is the same as the first but without all the extra language
> stuff. There the £ displays as a ?.
> 
> http://perl.wtsbroadcast.com/about/Angies_second_test_page.html
> 
> Very wierd. Same code generated both pages. To explain the whole set
> up would take a *long* time but I wondered if anyone else had seen
> this?
> 
>         $v = $q->url_param('fieldname');
> 
>         my $decoder = Encode::Guess->guess($v);
>         ref($decoder) or warn "Can't guess for $v: $decoder"; # trap error 
> this way
>         if (ref($decoder)) {
>                 my $utf8 = $decoder->decode($v) ? $decoder->decode($v) : $v;
>                 $params{$uarg} = $utf8;
>         }
>         else {
>                 $params{$uarg} = decode("utf8", $v) ? decode("utf8", $v) : $v;
>         }
> 
> I just can't fathom this.
> 
> MP1/Apache 1 on fedora core 2.
>

Reply via email to