Permalink
Browse files

encode/decode as binary utf8

Deals with the funny stuff seen in #771.

The documentation should also make clear what we do turn on the
utf8 flag on by default.

We should also make sure this doesn't
break other stuff at a distance -- I'm quite weary of the
comment in 'serialize' that we don't utf8 the thing there
because it's done "later on"...
  • Loading branch information...
1 parent eeccedf commit 18c5517b47d41fb0da64c34d6865baa22269035c @yanick yanick committed Sep 22, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Dancer/Serializer/JSON.pm
@@ -65,7 +65,10 @@ sub deserialize {
# Standard JSON behaviour is fine when serializing; we'll end up
# encoding as UTF8 later on.
sub _serialize_options_as_hashref {
- return shift->_options_as_hashref(@_);
+ my $self = shift;
+ my $options = $self->_options_as_hashref(@_) || {};
+ $options->{utf8} = 1 if !exists $options->{utf8};
+ return $options;
}
# JSON should be UTF8 by default, so explicitly decode it as such

0 comments on commit 18c5517

Please sign in to comment.