Kester Habermann wrote:
> Hi,
>
> I have two problem concerning utf-8 character encoding in maypole 2.05
> (svn head).
>
> Here is problem 1, I'll send problem 2 in another mail as it's
> something completely different.
>
> I'll illustrate the problem using the beerdb-example. The Encoding in
> th application is set to utf-8 (maypole default). I point my browser
> to
> http://localhost/beerdb/beer/list/
>
> and enter the character "ä" in the "Name"-field in the "Add a new
> beer"-form and press the "create"-button.
>
> the new page
>
> http://localhost/beerdb/beer/do_edit/
>
> shows title with "ä" and "Name: ä" (everything ok)
>
> Then I press "edit" and it shows:
>
> Edit ä (ok)
>
> Name: À (not ok)
>
> The HTML source ist:
>
> Name:</span><textarea name="name">ä</textarea>
>
> This is not ok. The two-byte sequence has been encoded as two seperate
> 1-byte charactes.
>
> A SELECT from database shows correct utf-8 char "ä" (À) inserted into
> database
>
> I had a look into Class::DBI::AsForm and it does something like this:
>
> use HTML::Element;
> print HTML::Element->new("textarea", name =>
> "lala")->push_content("À")->as_XML;
> <textarea name="lala">ä</textarea>
>
> There is the bug again.
>
> when I try this, it works:
>
> use HTML::Element;
> use utf8;
> print HTML::Element->new("textarea", name =>
> "lala")->push_content("À")->as_XML;
> <textarea name="lala">ä</textarea>
>
> But adding "use utf8;" to BeerDB.pm did not help.
utf8 is a lexical pragma that tells perl that the source code is utf8,
so in your example, that string ("À") has its utf8 flag on.
This also works without utf8.pm:
use HTML::Element;
print HTML::Element->new("textarea", name => "lala")
->push_content(chr(228))->as_XML;
<textarea name="lala">ä</textarea>
Are you sure the value you're getting back from the database is
correctly encoded?
Simon
_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT