[prev in list] [next in list] [prev in thread] [next in thread]
List: mason
Subject: Re: [Mason] UTF-8 characters
From: brett gardner <brett () clientcomm ! com ! au>
Date: 2007-10-10 2:51:55
Message-ID: 470C3E4B.3070209 () clientcomm ! com ! au
[Download RAW message or body]
It turns out it's due to the Apache::Table not storing the UTF-8 flag.
if you do the following.
my $foo = $r->param('foo');
$foo = decode('utf-8',$foo); #this sets the utf-8 flag.
my $before = Encode::is_utf8($foo); # $before will be set to 1.
$r->param('foo',[$foo]); #set the param
$foo = $r->param('foo'); #refetch the param
my $after = Encode::is_utf8($foo) # $after will be set to 0.
So everytime you pull a param from $r or use an arg you have to always
decode.
Andrew Chilton wrote:
> Hi Brett,
>
> On 10/10/2007, brett gardner <brett@clientcomm.com.au> wrote:
>
>> If I have a querystring paramater "foo" with a value set to "ogram'" (ie
>> it contains the UTF-8 character x{2019}).
>>
>> Displaying this value in the mason page sometimes displays correctly and
>> sometimes displays "ogramâ€"
>>
>
> I've seen this before and it seems to be the HTML::Entities escaping
> (which Mason uses internally). This is the only solution I could come
> up with (previously posted to this list):
>
> http://www.nabble.com/html-escaping-changed--t3853201.html
>
> So I add this line to my Apache Config and just escape the 'basic'
> chars (all one line):
>
> PerlSetVar MasonEscapeFlags
> "h => \\&HTML::Mason::Escapes::basic_html_escape"
>
> I've yet to hear or find out if this is actually a bad thing or if
> it's okay. It's the only way I've figured it out. Let me know if that
> solves your problem and also if you hear a better way of doing it.
>
> There are many sites these days which don't seem to be able to cope
> with escaping and sending out as UTF-8 so lots of sites display the
> problems you're talking about.
>
> Cheers,
> Andy
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic