It has been introduced by bug 11944.
Test plan:
1/ Install and set the fr-FR language (or ar-Arab).
2/ Go on the help page and edit it.
3/ The textarea should not contain encoding issues with this patch.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use C4::Output;
use C4::Templates;
use C4::Auth;
use CGI qw ( -utf8 );
use C4::Output;
use C4::Templates;
use C4::Auth;
use CGI qw ( -utf8 );
$type = 'create' if $type eq 'addnew';
if ( $type eq 'create' || $type eq 'save' ) {
my $file = _get_filepath($referer);
$type = 'create' if $type eq 'addnew';
if ( $type eq 'create' || $type eq 'save' ) {
my $file = _get_filepath($referer);
- open my $fh, ">", $file;
+ open my $fh, ">:encoding(utf-8)", $file;
if ( $fh ) {
# file is open write to it
print $fh
if ( $fh ) {
# file is open write to it
print $fh
} else {
(-w $file) or $error =
"WARNING: You will not be able to save, because your webserver cannot write to '$file'. Contact your admin about help file permissions.";
} else {
(-w $file) or $error =
"WARNING: You will not be able to save, because your webserver cannot write to '$file'. Contact your admin about help file permissions.";
- open (my $fh, '<', $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked
- my $help = '';
+ open (my $fh, '<:encoding(utf-8)', $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked
+ my $help = '';
while ( <$fh> ) {
$help .= /\[% INCLUDE .* %\](.*)$/ ? $1 : $_;
while ( <$fh> ) {
$help .= /\[% INCLUDE .* %\](.*)$/ ? $1 : $_;
- }
- close $fh;
- $template->param( 'help' => $help );
+ }
+ close $fh;
+ $template->param( 'help' => $help );