Grokbase
Topics Posts Groups | in
x
[ help ]

[html-formfu] catalyst, formfu and unicode

View TopicPrint | Flat  Thread  Threaded
1) Josef Chladek hello list, after endless hours of debugging, here are my recommendations for correct use of utf8...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
hello list,

after endless hours of debugging, here are my recommendations for  
correct use of utf8 with Catalyst and HTML::FormFu

1) don't use Catalyst::Plugin::Unicode
2) don't use "use utf8" in the controller, that has formfu stuff in it
3) don't use .yml configs, use Config::General instead (maybe others  
working as well)
4) in I18/de.pm remove "use utf8", otherwise error-messages corrupt  
the rest of the page

at least for me now everything is encoded correctly (and my other  
controllers work as well correctly with utf8)

C:P:Compress:Gzip is ok to use (contrary to what I said yesterday)

thanks for all the help
josef

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
2) Carl Franks I've had a look at the Cat app you sent - and I've managed to get it working properly. attribute in...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On 27/09/2007, Josef Chladek <josef.chladek@gmail.com> wrote:
> hello list,
>
> after endless hours of debugging, here are my recommendations for
> correct use of utf8 with Catalyst and HTML::FormFu
>
> 1) don't use Catalyst::Plugin::Unicode
> 2) don't use "use utf8" in the controller, that has formfu stuff in it
> 3) don't use .yml configs, use Config::General instead (maybe others
> working as well)
> 4) in I18/de.pm remove "use utf8", otherwise error-messages corrupt
> the rest of the page
>
> at least for me now everything is encoded correctly (and my other
> controllers work as well correctly with utf8)
>
> C:P:Compress:Gzip is ok to use (contrary to what I said yesterday)

I've had a look at the Cat app you sent - and I've managed to get it
working properly.

* Load Catalyst::Plugin::Unicode.

* Add the config option (ENCODING => 'UTF-8') to View/TT.
(DEFAULT_ENCODING is a View/TT/ForceUTF8 option - which shouldn't be necessary)

* Finally, the main thing that was causing problems was the lang="de"
attribute in the html tag in your foo.tt2 - remove it.

You should now find that form submissions with errors render ok.
I've also tested this with Compress::Gzip - and it works fine too.

If you find yourself having to remove Catalyst::Plugin::UTF8 or remove
"use utf8" from modules with utf8 in the source - then there's
something else going wrong.

To be honest, I don't know why the lang tag caused problems - I've
never used lang tags, and I also only use xhtml, not html.
I tried adding a meta tag with a lang="de" attribute, and it didn't
cause any problems, but I don't know if that has the same effect that
you're wanting.

Carl

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
3) Carl Franks I was looking at this again - and deleted all the files, and unarchived them again. It seemed to be...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On 27/09/2007, Carl Franks <fireartist@gmail.com> wrote:
> On 27/09/2007, Josef Chladek <josef.chladek@gmail.com> wrote:
> > hello list,
> >
> > after endless hours of debugging, here are my recommendations for
> > correct use of utf8 with Catalyst and HTML::FormFu
> >
> > 1) don't use Catalyst::Plugin::Unicode
> > 2) don't use "use utf8" in the controller, that has formfu stuff in it
> > 3) don't use .yml configs, use Config::General instead (maybe others
> > working as well)
> > 4) in I18/de.pm remove "use utf8", otherwise error-messages corrupt
> > the rest of the page
> >
> > at least for me now everything is encoded correctly (and my other
> > controllers work as well correctly with utf8)
> >
> > C:P:Compress:Gzip is ok to use (contrary to what I said yesterday)
>
> I've had a look at the Cat app you sent - and I've managed to get it
> working properly.
>
> * Load Catalyst::Plugin::Unicode.
>
> * Add the config option (ENCODING => 'UTF-8') to View/TT.
> (DEFAULT_ENCODING is a View/TT/ForceUTF8 option - which shouldn't be necessary)
>
> * Finally, the main thing that was causing problems was the lang="de"
> attribute in the html tag in your foo.tt2 - remove it.
>
> You should now find that form submissions with errors render ok.
> I've also tested this with Compress::Gzip - and it works fine too.
>
> If you find yourself having to remove Catalyst::Plugin::UTF8 or remove
> "use utf8" from modules with utf8 in the source - then there's
> something else going wrong.
>
> To be honest, I don't know why the lang tag caused problems - I've
> never used lang tags, and I also only use xhtml, not html.
> I tried adding a meta tag with a lang="de" attribute, and it didn't
> cause any problems, but I don't know if that has the same effect that
> you're wanting.

I was looking at this again - and deleted all the files, and
unarchived them again.
It seemed to be working fine with just the changes to Test.pm and View/TT.pm
The change to foo.tt2 doesn't seem necessary.

Carl

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
4) Jonas Alves You just need the "use utf8" if you have utf8 characters in you source, like the variables names....
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On 27/09/2007, Carl Franks <fireartist@gmail.com> wrote:

>
> If you find yourself having to remove Catalyst::Plugin::UTF8 or remove
> "use utf8" from modules with utf8 in the source - then there's
> something else going wrong.


You just need the "use utf8" if you have utf8 characters in you source, like
the variables names.
If you just have utf8 characters in strings or other kind of data than you
don't need to use it.

--
Jonas

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
5) Carl Franks I don't think that's correct. - The following 3 manual pages all say you need to "use utf8" if you...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On 27/09/2007, Jonas Alves <jonas.alves@gmail.com> wrote:
>
>
> On 27/09/2007, Carl Franks <fireartist@gmail.com> wrote:
> >
> > If you find yourself having to remove Catalyst::Plugin::UTF8 or remove
> > "use utf8" from modules with utf8 in the source - then there's
> > something else going wrong.
>
> You just need the "use utf8" if you have utf8 characters in you source, like
> the variables names.
> If you just have utf8 characters in strings or other kind of data than you
> don't need to use it.

I don't think that's correct. - The following 3 manual pages all say
you need to "use utf8" if you have UTF-8 in string constants / string
literals.
"source" doesn't just mean identifier / variable names.

perluniintro
Only one case remains where an explicit use utf8 is needed: if your
Perl script itself is encoded in UTF-8, you can use UTF-8 in your
identifier names, and in string and regular expression literals, by
saying use utf8. This is not the default because scripts with legacy
8-bit data in them would break.

perlunicode
As a compatibility measure, the use utf8 pragma must be explicitly
included to enable recognition of UTF-8 in the Perl scripts themselves
(in string or regular expression literals, or in identifier names)

utf8
Bytes in the source text that have their high-bit set will be treated
as being part of a literal UTF-X sequence. This includes most literals
such as identifier names, string constants, and constant regular
expression patterns.

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
6) Jonas Alves Ok, I'm not an utf8 expert. But I never "use utf8" in my unicode applications and if i always...
| +1 vote (Anchor)
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
On 28/09/2007, Carl Franks <fireartist@gmail.com> wrote:
>
> On 27/09/2007, Jonas Alves <jonas.alves@gmail.com> wrote:
> >
> >
> > On 27/09/2007, Carl Franks <fireartist@gmail.com> wrote:
> > >
> > > If you find yourself having to remove Catalyst::Plugin::UTF8 or remove
> > > "use utf8" from modules with utf8 in the source - then there's
> > > something else going wrong.
> >
> > You just need the "use utf8" if you have utf8 characters in you source,
> like
> > the variables names.
> > If you just have utf8 characters in strings or other kind of data than
> you
> > don't need to use it.
>
> I don't think that's correct. - The following 3 manual pages all say
> you need to "use utf8" if you have UTF-8 in string constants / string
> literals.
> "source" doesn't just mean identifier / variable names.
>
> perluniintro
> Only one case remains where an explicit use utf8 is needed: if your
> Perl script itself is encoded in UTF-8, you can use UTF-8 in your
> identifier names, and in string and regular expression literals, by
> saying use utf8. This is not the default because scripts with legacy
> 8-bit data in them would break.
>
> perlunicode
> As a compatibility measure, the use utf8 pragma must be explicitly
> included to enable recognition of UTF-8 in the Perl scripts themselves
> (in string or regular expression literals, or in identifier names)
>
> utf8
> Bytes in the source text that have their high-bit set will be treated
> as being part of a literal UTF-X sequence. This includes most literals
> such as identifier names, string constants, and constant regular
> expression patterns.


Ok, I'm not an utf8 expert. But I never "use utf8" in my unicode
applications and if i always encode and decode the data correctly everything
is fine.
I'm pretty sure I've read somewhere that you just need the "use utf8" pragma
if you have utf8 characters in variables names. I don't remember where it
was so i can't say if it's correct.

--
Jonas

_______________________________________________
HTML-FormFu mailing list
[email protected: HTML-F...@lists.scsys.co.uk]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
spacer
View TopicPrint | Flat  Thread  Threaded
Home > Groups > HTML::FormFu > [html-formfu] catalyst, formfu and unicode (6 posts)