Moving away from yaml to (where to.)

Hi,

Are there alternatives to yaml files?

Specifically configuration formats that do not coerce the user into a
specific encoding format.

I need mostly:

key: value pairs

although the ability to load arrays directly into a .rb file would be
cool too.

Reason: I can no longer use yaml files in ruby 2.0 if they are not in
UTF. As I do not use UTF and never will, yet syck has been removed, I
need another way to load my configuration settings (I use several
hundred yaml files). Without that I would be forced to not use my
configuration settings (which is currently in yaml) so upgrading my ruby
version gives me only drawbacks and extra work and no benefit.

My current ruby in use is ruby 1.9.3p448 (2013-06-27 revision 41675)
[i686-linux]

Any reason why JSON is not suitable?

On 09/03/2013 02:32 PM, Peter H. wrote:

Any reason why JSON is not suitable?

The JSON specification at http://tools.ietf.org/html/rfc4627 states:

“JSON text SHALL be encoded in Unicode. The default encoding is
UTF-8.”

The original poster stated:

“As I do not use UTF and never will[…]”

I guess that rules out JSON, and a lot of other things besides.
Good luck, though.

On Sep 3, 2013, at 8:31 AM, Peter H. wrote:

The desire not to use UTF-8 seems to be a religious issue given the the OP has
not given any reason or described a problem that they are having with YAML

I’m wondering about that as well. UTF-8 imposes no penalty if you want
to restrict yourself to the basic ASCII character set. Seems like an odd
avoidance given the lack of any real penalty.

Wayne

If the configuration settings are data structures in the Ruby program
then
you can convert them to and from JSON. The fact that they are encoded
with
UTF-8 is transparent and pretty irrelevant unless the data is in some
esoteric format (but then how would Ruby handle this anyway?).

The desire not to use UTF-8 seems to be a religious issue given the the
OP
has not given any reason or described a problem that they are having
with
YAML. If they are prepared to convert their current settings files from
YAML to some other, as yet unspecified, format they could just as easily
just convert the data to UTF-8 and be done with it.

Am 03.09.2013 um 15:34 schrieb Wayne B. [email protected]:

On Sep 3, 2013, at 8:31 AM, Peter H. wrote:

The desire not to use UTF-8 seems to be a religious issue given the the OP has
not given any reason or described a problem that they are having with YAML

I’m wondering about that as well. UTF-8 imposes no penalty if you want to
restrict yourself to the basic ASCII character set. Seems like an odd avoidance
given the lack of any real penalty.

Wayne

Also, YAML is a unicode based format as well and handling other things
is a SYCK implementation detail. So, the true quesition is: “moving away
from SYCK, where to?”

Am 03.09.2013 16:29, schrieb Florian G.:

So, the true quesition is: “moving away from SYCK, where to?”

What’s wrong with Psych (the default)?

Regards,
Marcus

Marc H. [email protected] wrote:

Hi,

Are there alternatives to yaml files?

I need mostly:

key: value pairs

although the ability to load arrays directly into a .rb file would be
cool too.

You could try to make CSV work for you.

Or just inspect/pp + eval if you want to live dangerously.

Reason: I can no longer use yaml files in ruby 2.0 if they are not in
UTF. As I do not use UTF and never will, yet syck has been removed, I
need another way to load my configuration settings (I use several
hundred yaml files). Without that I would be forced to not use my
configuration settings (which is currently in yaml) so upgrading my ruby
version gives me only drawbacks and extra work and no benefit.

YAML can store binary, too. It isn’t pretty, but you can continue
using whatever encoding you want:


FOO: !binary |-
8Ss3UyKu9iXkSC0=

Am 03.09.2013 14:15, schrieb Marc H.:

Hi,

Are there alternatives to yaml files?

I need mostly:

key: value pairs

although the ability to load arrays directly into a .rb file would be
cool too.

Best option: YAML (surprise)

Reason: I can no longer use yaml files in ruby 2.0 if they are not in UTF.

???

Yes you can.

ASCII works out of the box (it is valid UTF-8),
other encodings could be converted before parsing them.

Regards,
Marcus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs