Navigation Menu

Skip to content

Commit

Permalink
Item13575: Item13573: Make store a bit more robust
Browse files Browse the repository at this point in the history
When saving a topic in non-utf8 encoding, rather than croak when an
unsupported character is encountered,  save it as an entity.
  • Loading branch information
gac410 committed Jul 28, 2015
1 parent 7e31413 commit 7e7e111
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/lib/Foswiki/Store.pm
Expand Up @@ -60,6 +60,7 @@ use Assert;

use Foswiki ();
use Foswiki::Sandbox ();
use HTML::Entities ();

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
Expand Down Expand Up @@ -274,7 +275,7 @@ sub encode {
return $_[0] unless defined $_[0];
my $s = $_[0];
return Encode::encode( $Foswiki::cfg{Store}{Encoding} || 'utf-8',
$s, Encode::FB_CROAK );
$s, sub { HTML::Entities::encode_entities( chr(shift) ) } );
}

1;
Expand Down

0 comments on commit 7e7e111

Please sign in to comment.