Permalink
Browse files

Item13575: Item13573: Make store a bit more robust

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 7e7e1118ddd6f3aa6fff2fed01fbc4a82a4a5416
Showing with 2 additions and 1 deletion.
  1. +2 −1 core/lib/Foswiki/Store.pm
@@ -60,6 +60,7 @@ use Assert;
use Foswiki ();
use Foswiki::Sandbox ();
use HTML::Entities ();
BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
@@ -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;

0 comments on commit 7e7e111

Please sign in to comment.