Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 51886
Status: resolved
Priority: 0/
Queue: YAML-LibYAML

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

Bug Information
Severity: (no value)
Broken in: 0.32
Fixed in: (no value)



Subject: YAML::XS sets utf8 flag on everything
All data read with YAML::XS seems to have the utf8 flag on: perl -MYAML::XS -E ' my $config = YAML::XS::LoadFile("myapp.yml"); say((utf8::is_utf8($config->{name}) ? "is" : "is not"), " utf8"); ' is utf8 This can lead to unpredictable results, as e.g. described here: http://lists.scsys.co.uk/pipermail/catalyst/2009-November/023907.html http://lists.scsys.co.uk/pipermail/catalyst/2009-November/023918.html On the other hand: perl -MYAML::Syck -E ' my $config = YAML::Syck::LoadFile("myapp.yml"); say((utf8::is_utf8($config->{name}) ? "is" : "is not"), " utf8"); ' is not utf8 perl -MYAML -E ' my $config = YAML::LoadFile("myapp.yml"); say((utf8::is_utf8($config->{name}) ? "is" : "is not"), " utf8"); ' is not utf8
Le Lun 23 Nov 2009 13:18:31, GRAF a écrit : Show quoted text
> All data read with YAML::XS seems to have the utf8 flag on:
The YAML spec says that YAML files are encoded in UTF-8 by default. http://www.yaml.org/spec/1.2/spec.html#id2771184 So what's wrong? -- Olivier Mengué - http://o.mengue.free.fr/
On Tue Feb 16 18:21:10 2010, DOLMEN wrote: Show quoted text
> Le Lun 23 Nov 2009 13:18:31, GRAF a écrit :
> > All data read with YAML::XS seems to have the utf8 flag on:
> > The YAML spec says that YAML files are encoded in UTF-8 by default. > http://www.yaml.org/spec/1.2/spec.html#id2771184 > > So what's wrong?
The fact that YAML files are encoded in UTF-8 does not tell anything about how the deserialized perl data structures should look like. But then, putting the internal utf-8 flag to every perl scalar is not really wrong. It's just not ideal for performance, as utf-8 flagged scalars are slower than byte scalars. So I would expect that the utf8 flag is set only if necessary, i.e. if characters > codepoint 255 appear. Regards, Slaven
This was fixed in 0.34 and is tested in t/ascii.t