Committer: vad
LJSUP-9628: remove some warnings from error logU trunk/cgi-bin/LJ/Share.pm
Modified: trunk/cgi-bin/LJ/Share.pm =================================================================== --- trunk/cgi-bin/LJ/Share.pm 2011-08-25 11:25:12 UTC (rev 19851) +++ trunk/cgi-bin/LJ/Share.pm 2011-08-25 16:05:24 UTC (rev 19852) @@ -82,14 +82,18 @@ $opts->{'description'} = LJ::ejs( LJ::Text->drop_html($entry->event_raw) ); $opts->{'url'} = $entry->url; - $opts->{'title'} = Encode::decode_utf8($opts->{'title'}); - $opts->{'description'} = Encode::decode_utf8($opts->{description}); + if ($opts->{'title'}){ + $opts->{'title'} = Encode::decode_utf8($opts->{'title'}); + $opts->{'title'} =~ s/\r|\n|\x85|\x{2028}|\x{2029}//gsm; + $opts->{'title'} = Encode::encode_utf8($opts->{'title'}); + } - $opts->{'title'} =~ s/\r|\n|\x85|\x{2028}|\x{2029}//gsm; - $opts->{'description'} =~ s/\r|\n|\x85|\x{2028}|\x{2029}//gsm; + if ($opts->{'description'}){ + $opts->{'description'} = Encode::decode_utf8($opts->{description}); + $opts->{'description'} =~ s/\r|\n|\x85|\x{2028}|\x{2029}//gsm; + $opts->{'description'} = Encode::encode_utf8($opts->{description}); + } - $opts->{'title'} = Encode::encode_utf8($opts->{'title'}); - $opts->{'description'} = Encode::encode_utf8($opts->{description}); } my $opts_out = LJ::JSON->to_json($opts);