[Maypole-dev] UTF-8 problem with Maypole and Class::DBI::AsForm / HTML::Element

From: Kester Habermann (kester.habermann at gmail.com)
Date: Tue Dec 14 2004 - 22:56:52 GMT


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">&#195;&#164;</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">&#195;&#164;</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">&#228;</textarea>

But adding "use utf8;" to BeerDB.pm did not help.

Does anyone know how to fix this?

Regards, Kester.

_______________________________________________
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