mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug - UTF8
- Fixed bug in the handling of UTF8 JSON data from holidata.net, when update-holidays.pl when decoding and writing files.
This commit is contained in:
parent
7a45db4d0f
commit
0a0e8f0d6b
2 changed files with 12 additions and 4 deletions
|
@ -270,6 +270,8 @@
|
|||
+ Fixed problem with non-UTC defaults for "TZ" (thanks to Owen Clarke).
|
||||
+ Removed use of Lua API call that is deprecated in 5.1 and removed from 5.2
|
||||
(thanks to Michal Vyskocil).
|
||||
+ Fixed problem where update-holidays.pl did not properly handle UTF8 JSON
|
||||
data.
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -45,6 +45,13 @@ if ($@)
|
|||
exit 1;
|
||||
}
|
||||
|
||||
eval "use Encode";
|
||||
if ($@)
|
||||
{
|
||||
print "Error: You need to install the Encode Perl module.\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Command line options, argument validation.
|
||||
my $help;
|
||||
my $locale;
|
||||
|
@ -147,8 +154,8 @@ print "\n",
|
|||
|
||||
# Without data, cannot proceed.
|
||||
my $data;
|
||||
$data .= $data_current if defined $data_current;
|
||||
$data .= $data_next if defined $data_next;
|
||||
$data .= decode ('utf-8', $data_current) if defined $data_current;
|
||||
$data .= decode ('utf-8', $data_next) if defined $data_next;
|
||||
exit (1) if !defined $data || $data eq '';
|
||||
|
||||
# Filter the holidays according to @regions.
|
||||
|
@ -170,8 +177,7 @@ for my $holiday (split /\n/ms, $data)
|
|||
}
|
||||
|
||||
# Overwrite the file.
|
||||
if (open my $fh, '>', $file)
|
||||
#if (open my $fh, '>:encoding(UTF-8)', $file)
|
||||
if (open my $fh, '>:utf8', $file)
|
||||
{
|
||||
print $fh
|
||||
"# International Holiday Data provided by Holidata.net\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue