From: Aaron Patterson Date: 2012-08-23T13:09:26+09:00 Subject: [ruby-core:47293] Re: [ruby-trunk - Feature #6910][Assigned] Loading syck's broken yaml with psych --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 23, 2012 at 11:04:22AM +0900, naruse (Yui NARUSE) wrote: >=20 > Issue #6910 has been reported by naruse (Yui NARUSE). >=20 > ---------------------------------------- > Feature #6910: Loading syck's broken yaml with psych > https://bugs.ruby-lang.org/issues/6910 >=20 > Author: naruse (Yui NARUSE) > Status: Assigned > Priority: Normal > Assignee: tenderlovemaking (Aaron Patterson) > Category: ext > Target version: 2.0.0 >=20 >=20 > You know, syck outputs wrong yaml. > For example, syck works as following: >=20 > ruby-1.9.2 > ["\u3042",Time.at(0).to_s].to_yaml > =3D> "--- \n- \"\\xE3\\x81\\x82\"\n- 1970-01-01 09:00:00 +09:00\n" >=20 > It should be >=20 > ruby-1.9.3 > ["\u3042",Time.at(0).to_s].to_yaml > =3D> "---\n- =E3=81=82\n- '1970-01-01 09:00:00 +0900'\n" >=20 > syck's dump of Unicode string is interpreted as "\u00E3\u0081\u0082". > syck's dump of Time like string is interpreted as Time. > It is hard to migrate old data to new and correct data, so it is useful i= f psych has a such compatibility option. It's possible to have both syck and psych loaded in 1.9.3 (also 1.9.2 I think): require 'syck' require 'yaml' require 'psych' =20 def convert legacy Psych.dump YAML.load legacy end =20 legacy =3D YAML.dump ["\u3042",Time.at(0).to_s] =20 puts convert legacy I'm pushing syck to a gem so people can do this even further in the future. --=20 Aaron Patterson http://tenderlovemaking.com/ --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) iQEcBAEBAgAGBQJQNazwAAoJEJUxcLy0/6/G9BUH/2ZcMrsv9YS5UdZC/04BwvDy a5GZ8nJRFhAdU4miKIqlxT00/QfTQwLF6SQaVLCCQew0HlZ03A+TD5Bw96mrZpRQ SxOO/zsuZHujOrq8EgVmbZD9yiPLJnBskMlOM76SxB+zvAcZsJc5Nptbu/g7teeH 8Dzrgcu3AZ2t1pN1JVCYaDGPsY/Aavu0X2GIqsC/ObtXoBSlBk8ANq+x8jN+srYh 7CyGq0wwCzXWyDWD9LnrPbrYQdEIRpb5OQkDzTkV6wFb6NJeeeVSZN80zmzaYxe2 3hqOiF2HhipcGMSEZPffo1mINCl4EVb1L2xsqxVzVuvqzn8PeWigTV4j9p1TqJI= =w2d4 -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--