[Catalyst] Re: [Dbix-class] Re: utf8 / pg double encoding problem

Daniel McBrearty danielmcbrearty at gmail.com
Mon Jan 7 15:57:38 GMT 2008


well, the moral is probably "never work on your code when recovering from flu".

It was pretty much a self-induced problem. I have a system where the
user submits a value, and the value is copied back to them. If there
is a network problem with corruption of the data, they will see it, as
the returned string should show the problem.

I had a problem where the string being returned was in pure unicode
code points (not utf8). Somehow I convinced myself that the problem
was on the source side, and added a utf8 encoding in the sending js.
Oops. The result was obvious ...

Data is actually sent in URI encoded utf8 (looks like "ab%C3%A7
...."), which is fine. The string is then picked up, decoded and
stored in the db just fine. The problem is that what gets sent back
the other way (via Catalyst::View::JSON ) is not getting encoded. I
don't know quite why just now (according to the docs it should do).
Manually adding the Encode::encode_utf8( $result ) step fixes it for
now. I may try peeking to see why it doesn't get handled by the View.

there is still a slight oddity that now, the $edit parameter shows
just fine in the debug screen, is confirmed as being "yes its UTF8",
but $c->log->debug( $edit ) does not print ok. Odd, but not really any
worry right now. Some kind of argument between perl and the terminal?
but why OK in the usual debug output, but not with $c->log->debug?

thanks to those who pointed in the right direction, anyhow.



More information about the Catalyst mailing list