Re: [cgiapp] UTF-8 output

2010-03-08 Thread Mark Rajcok
On Sun, Feb 28, 2010 at 12:12 AM, Mark Rajcok wrote: > On Mon, Nov 2, 2009 at 9:27 AM, Michael Peters wrote: > >> > And is there no better way for the template output than to post_process >> > the whole template? Is there no way to get the output of tt_process as >> > UTF-8 so that there is no po

Re: [cgiapp] UTF-8 output

2010-02-27 Thread Mark Rajcok
On Mon, Nov 2, 2009 at 9:27 AM, Michael Peters wrote: > > And is there no better way for the template output than to post_process > > the whole template? Is there no way to get the output of tt_process as > > UTF-8 so that there is no post_processing necessary? > > I have a patched HTML::Template

Re: [cgiapp] UTF-8 output

2009-11-19 Thread Mike Tonks
I have the following in my cgiapp_init: binmode STDOUT, ":utf8"; # Explicitly output utf8 - this is critical probably totally wrong, but it works for me... 2009/11/4 Michael Lackhoff : > On 04.11.2009 12:19 Cees Hek wrote: > >> You mean something like this: >> >> __PACKAGE__->add_call

Re: [cgiapp] UTF-8 output

2009-11-04 Thread Michael Lackhoff
On 04.11.2009 12:19 Cees Hek wrote: > You mean something like this: > > __PACKAGE__->add_callback('postrun', sub { > my $self = shift; > > # Make sure the output is utf8 encoded if it needs it > if ( $_[0] && ${$_[0]} && utf8::is_utf8(${$_[0]}) ){ > utf8::encode( ${$_[0]} );

Re: [cgiapp] UTF-8 output

2009-11-04 Thread Cees Hek
On Wed, Nov 4, 2009 at 9:49 PM, Michael Lackhoff wrote: > On 04.11.2009 11:24 Cees Hek wrote: > >> Can't you get DBI to do the decoding for you?  I think it will depend >> on the DBD module you use, but it is quite easy with PostgeSQL: > > I am using SQLite and it is also quite easy there but then

Re: [cgiapp] UTF-8 output

2009-11-04 Thread Michael Lackhoff
On 04.11.2009 11:24 Cees Hek wrote: > Can't you get DBI to do the decoding for you? I think it will depend > on the DBD module you use, but it is quite easy with PostgeSQL: I am using SQLite and it is also quite easy there but then I have -- as you say -- _decoded_ values. This is what I want wi

Re: [cgiapp] UTF-8 output

2009-11-04 Thread Cees Hek
On Wed, Nov 4, 2009 at 6:15 PM, Michael Lackhoff wrote: > On 03.11.2009 23:27 Cees Hek wrote: > >> However, I guess you should ensure that any data that you send to TT >> is utf8 encoded. > > That's exactly the problem. I pass lots of RDBO objects into the > templates and those should contain deco

Re: [cgiapp] UTF-8 output

2009-11-03 Thread Michael Lackhoff
On 03.11.2009 23:27 Cees Hek wrote: > However, I guess you should ensure that any data that you send to TT > is utf8 encoded. That's exactly the problem. I pass lots of RDBO objects into the templates and those should contain decoded (UTF-8 flag on) data, not UTF-8 octets, so I guess encoding the

Re: [cgiapp] UTF-8 output

2009-11-03 Thread Cees Hek
On Wed, Nov 4, 2009 at 12:15 AM, Michael Lackhoff wrote: > On 03.11.2009 01:22 Cees Hek wrote: > >> Have a look at this perlmonks post by Rhesa: >> >> http://www.perlmonks.org/?node_id=651574 > > Thanks Cees (and of course Rhesa), this is exactly what I need! > > Since you are the author of CAP::T

Re: [cgiapp] UTF-8 output

2009-11-03 Thread Emmanuel Seyman
* Michael Lackhoff [02/11/2009 20:38] : > > Thanks for the hint! But isn't it better then to tackle the problem > right at the root: > $webapp->query->charset('UTF-8'); # works! Probably. I've always felt that the most appropriate solution would be for CGI to default to UTF-8. > because this woul

Re: [cgiapp] UTF-8 output

2009-11-03 Thread Michael Lackhoff
On 03.11.2009 01:22 Cees Hek wrote: > Have a look at this perlmonks post by Rhesa: > > http://www.perlmonks.org/?node_id=651574 Thanks Cees (and of course Rhesa), this is exactly what I need! Since you are the author of CAP::TT, may I also ask how and when you do the encoding of the template ou

Re: [cgiapp] UTF-8 output

2009-11-02 Thread Cees Hek
On Tue, Nov 3, 2009 at 3:23 AM, Michael Lackhoff wrote: > Sounds very interesting. Let me try to follow: > I am in the process of changing the db connection as well but have still > some problems with CGI params. How do you decode them? Not one at a > time, I guess? In my app they seem to be encod

Re: [cgiapp] UTF-8 output

2009-11-02 Thread Michael Lackhoff
On 02.11.2009 16:21 Emmanuel Seyman wrote: >>From CGI.pm : > > # set charset to the safe ISO-8859-1 > $self->charset('ISO-8859-1'); > > http://cpansearch.perl.org/src/LDS/CGI.pm-3.48/lib/CGI.pm Thanks for the hint! But isn't it better then to tackle the problem right at the root: $webap

Re: [cgiapp] UTF-8 output

2009-11-02 Thread Michael Lackhoff
On 02.11.2009 15:27 Michael Peters wrote: > On 11/02/2009 12:43 AM, Michael Lackhoff wrote: > >> Without the header_add I get >> a HTTP header with an ISO-8859-1 charset definition so the browser >> thinks it is latin1 and even a >> >> in the template won't help. > > That's very strange. Does i

Re: [cgiapp] UTF-8 output

2009-11-02 Thread Emmanuel Seyman
* Michael Lackhoff [02/11/2009 09:25] : > > I am using CAP::Dispatch and the TT-plugin. Without the header_add I get > a HTTP header with an ISO-8859-1 charset definition so the browser I believe you're seeing this because CGI::App use the CGI module, which defaults to ISO-8859-1 as a charset. >F

Re: [cgiapp] UTF-8 output

2009-11-02 Thread Michael Peters
On 11/02/2009 12:43 AM, Michael Lackhoff wrote: > Without the header_add I get > a HTTP header with an ISO-8859-1 charset definition so the browser > thinks it is latin1 and even a > > in the template won't help. That's very strange. Does it happen the same across all browsers? The tag should