Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
yanick committed Sep 22, 2013
commit 18c5517b47d41fb0da64c34d6865baa22269035c
5 changes: 4 additions & 1 deletion lib/Dancer/Serializer/JSON.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down