Hi !

  Neither the http protocol or mason deals with decoding of inputs.
  If your param potentially contains utf-8 encoded unicode characters
as well as html entities,  then you
  have to decode it like that:

      my $dec =
HTML::Entities::decode_entities(Encode::decode_utf8($r->param('myparam')));

  Then $dec will be a perl unicode string with its own internal
representation you should care about.

  The use utf8; is just a pragma to tell the interpreter your source
code is encoded in UTF8. If you don't program with exotic accentuated
characters in your source code, then it's not an issue.

  To store and retrieve later perl string in and from mysql with UTF8
encoding, you have to turn on the
 ' mysql_enable_utf8 option of the mysql driver.

 As they say in the doc, this option is experimental but I've been
using it for years.

 <opinion>
 If you want an open source database that handle this transparently
and in a non experimental way (plus lot of features which should be
implemented as standard in any serious database software), use
postgresql.
 </opinion>

 If you read french, I wrote a post about those unicode issues with
the stack mysql/apache/perl/mason :
 http://perlmason.blogspot.com/2007/09/internationalisation-i18n-unicode-et.html


Cheers !!

Jerome.


On Wed, Jan 14, 2009 at 7:23 PM, Tech list <tech_l...@womenshealth.com> wrote:
> I have a form that sends the textContent of a div.  When it contains
> '&nbsp;' chars I get unicode character 194, which is "Â".  How can I have
> perl see this correctly?  "use utf8;" at the top didn't seem to help...  I
> also want to save it in mysql correctly as well.
> Thanks!
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>



-- 
Jerome Eteve.

Chat with me live at http://www.eteve.net

jer...@eteve.net

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to