On Wed, Jan 14, 2009 at 11:23 AM, 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.
>

&nbsp; is U+00A0.  In UTF-8, it is \xC2\xA0. That is where you are
getting the 194 (\xC2). Luckily, this implies that the posted data is
in UTF-8. Solving this is the first problem with Unicode on the web.
This is normally done by having the HTML pages in UTF-8.

The next step is converting the UTF-8 byte string into a Perl Unicode
string.  CGI.pm will do the conversion if the charset is set to
"utf-8". I don't know if Apache2::Request can do the conversion
automatically.  Otherwise, Encode::decode_utf8 should do the job.

 - Ian
------------------------------------------------------------------------------
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