From 15e06bd07fc7f9cced5480b634443bf8d4474a9c Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Thu, 27 Aug 2015 16:55:18 -0700 Subject: [PATCH] Leave template view json as a character string Catalyst will encode it. --- lib/MetaCPAN/Web/View/HTML.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/MetaCPAN/Web/View/HTML.pm b/lib/MetaCPAN/Web/View/HTML.pm index 7e795bc511..737fd8d036 100644 --- a/lib/MetaCPAN/Web/View/HTML.pm +++ b/lib/MetaCPAN/Web/View/HTML.pm @@ -90,7 +90,9 @@ Template::Alloy->define_vmethod( 'text', Template::Alloy->define_vmethod( 'hash', pretty_json => sub { - JSON::MaybeXS->new->utf8->pretty->encode(shift); + + # Use utf8(0) because Catatlyst expects our view to be a character string. + JSON::MaybeXS->new->utf8(0)->pretty->encode(shift); } );