Skip Menu |

This queue is for tickets about the YAML-Tiny CPAN distribution.

Report information
The Basics
Id: 48885
Status: resolved
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.51
  • 1.40
  • 1.41
  • 1.42
  • 1.43
Fixed in: 1.57



Subject: DumpFile does not write in utf8
YAML::Tiny::DumpFile does not write YAML files using the UTF-8 encoding. Instead it uses the default platform encoding (which on Windows is not UTF-8).
Subject: 22_utf8.t
use utf8; use Test::More tests => 6; use YAML::Tiny qw/DumpFile LoadFile/; ok defined &DumpFile, 'DumpFile exported'; ok defined &LoadFile, 'LoadFile exported'; my $file = 't/dump.yaml'; # A scalar containing non-ASCII characters my $data = 'Olivier Mengué'; is length($data), 14, 'Test source is correctly encoded'; DumpFile($file, $data); ok -e $file, 'Output file exists'; open IN, '<:utf8', $file or die $!; my $yaml = do { local $/; <IN> }; close IN; is $yaml, "--- '$data'\n", 'DumpFile YAML encoding is correct'; my $read = LoadFile($file); is $read, $data, 'LoadFile is ok'; unlink $file;
Note that the attached test case above requires Perl UTF-8 support which YAML::Tiny tries to avoid (to at least be able to load ASCII files). So the test case need a rewrite before being committed.
This is a major bug as YAML::Tiny is used by Module::Build and Module::Install to generate META.yml files. The YAML distribution has been recently a victim of this bug as its META.ym has been encoded in latin1 instead of UTF-8. https://rt.cpan.org/Public/Bug/Display.html?id=55116 -- Olivier Mengué - http://o.mengue.free.fr/
YAML::Tiny is also used by Module::Build to generate MYMETA.yml. This has a wider impact as this affect the final user, not just the distribution authors. This makes MYMETA.yml usage fail on platforms where UTF-8 is not the default encoding (Windows) and the tool that reads the MYMETA.yml use a different (UTF-8 compliant) library. Here is a example (the author name, myself, contains non-ascii characters): http://ppm4.activestate.com/MSWin32-x86/5.12/1200/D/DO/DOLMEN/POE-Component-Schedule-0.95.d/log-20100525T210050.txt -- Olivier Mengué - http://o.mengue.free.fr/
When write is fixed, this should be fixed as well. I have a PR that does this: https://github.com/Perl-Toolchain-Gang/YAML-Tiny/pull/2
This is now fixed in the repository.
fixed in 1.57 release