BARRIER - ruby yaml - utf-8 characters not human readable

After reading within some archives, it seems that the standard-
behaviour of ruby is to save utf-8 data within yaml files in this
form:

δοκιμή => "\x9B\xA6\xA1\xA0\xA3\xE3"

Is this so?

If yes, what is the simplest way to change this behaviour?

Requirements:

* solution should be usable for end-users
* solution should not require any changes within the application
which uses yaml

Example solution:

* gem install another-yaml-which-saves-human-readable-utf-8

.

···

--
http://lazaridis.com

Here's an idea:

"Fix" it yourself. I'd also ask you to quit with the subject FUD but we all know you don't know how to read other people's replies.

- Jason

···

On May 20, 2011, at 11:30 AM, Ilias Lazaridis wrote:

After reading within some archives, it seems that the standard-
behaviour of ruby is to save utf-8 data within yaml files in this
form:

δοκιμή => "\x9B\xA6\xA1\xA0\xA3\xE3"

Is this so?

If yes, what is the simplest way to change this behaviour?

Requirements:

* solution should be usable for end-users
* solution should not require any changes within the application
which uses yaml

Example solution:

* gem install another-yaml-which-saves-human-readable-utf-8

.

--
http://lazaridis.com

Serialization of data depends on encoding. Learn about encodings and
Ruby support of it before asking questions.

Learn YAML specification about how it serializes non-ASCII
information.

If YAML doesn't fit you, write your own.

YAML specs:
http://www.yaml.org/spec/

Ruby encoding analysis:

http://blog.segment7.net/2011/02/02/string-encoding-quick-start
http://blog.segment7.net/2010/12/17/from-iconv-iconv-to-string-encode

···

On May 20, 11:26 am, Ilias Lazaridis <il...@lazaridis.com> wrote:

After reading within some archives, it seems that the standard-
behaviour of ruby is to save utf-8 data within yaml files in this
form:

äïêéìÞ => "\x9B\xA6\xA1\xA0\xA3\xE3"

Is this so?

--
Luis Lavena

fixed for ruby 1.9.3:

(changed default YAML from "syck" to "psych", which saves utf-8 data
human readable)

.

···

On 20 Μάϊος, 18:26, Ilias Lazaridis <il...@lazaridis.com> wrote:

After reading within some archives, it seems that the standard-
behaviour of ruby is to save utf-8 data within yaml files in this
form:

äïêéìÞ => "\x9B\xA6\xA1\xA0\xA3\xE3"

Is this so?

If yes, what is the simplest way to change this behaviour?

Requirements:

* solution should be usable for end-users
* solution should not require any changes within the application
which uses yaml

Example solution:

* gem install another-yaml-which-saves-human-readable-utf-8

--
http://lazaridis.com

Mr. Roelofs.

I've observed the utf-8 behaviour of ruby yaml on a local installation
(ruby 1.9.2 windows 7 greek). As a first step I've read some existent
topics (which confirmed my observations).

The usual step (before going to a dev-list or to an issue-tracking-
system) is to *confirm* the issue within a user medium.

It is a standard process that I'm following, in order to protect the
time of the core developers.

I ask you friendly to respect the public nature of this usenet group -
please refrain from further off-topic comments.

.

···

On 20 Μάϊος, 23:18, Jason Roelofs <jameskil...@gmail.com> wrote:

On May 20, 2011, at 11:30 AM, Ilias Lazaridis wrote:

> After reading within some archives, it seems that the standard-
> behaviour of ruby is to save utf-8 data within yaml files in this
> form:

> δοκιμή => "\x9B\xA6\xA1\xA0\xA3\xE3"

> Is this so?

> If yes, what is the simplest way to change this behaviour?

> Requirements:

> * solution should be usable for end-users
> * solution should not require any changes within the application
> which uses yaml

> Example solution:

> * gem install another-yaml-which-saves-human-readable-utf-8

Here's an idea:

"Fix" it yourself. I'd also ask you to quit with the subject FUD but we all know you don't know how to read other people's replies.

--
http://lazaridis.com

[...] - off context comments

Can someone please confirm, if this is the standard ruby 1.9
behaviour?

utf-8 data saved to yaml file:

δοκιμή becomes "\x9B\xA6\xA1\xA0\xA3\xE3"

.

···

On 21 Μάϊος, 19:10, Luis Lavena <luislav...@gmail.com> wrote:

--
http://lazaridis.com

Hello,

···

On 01 Ιουν 2011, at 12:55 μ.μ., Ilias Lazaridis wrote:

On 20 Μάϊος, 18:26, Ilias Lazaridis <il...@lazaridis.com> wrote:

After reading within some archives, it seems that the standard-
behaviour of ruby is to save utf-8 data within yaml files in this
form:

äïêéìÞ => "\x9B\xA6\xA1\xA0\xA3\xE3"

Is this so?

If yes, what is the simplest way to change this behaviour?

Requirements:

* solution should be usable for end-users
* solution should not require any changes within the application
which uses yaml

Example solution:

* gem install another-yaml-which-saves-human-readable-utf-8

fixed for ruby 1.9.3:

(changed default YAML from "syck" to "psych", which saves utf-8 data
human readable)

Bug #4758: yaml file not human readable when saving utf-8 - Ruby master - Ruby Issue Tracking System

.

--
http://lazaridis.com

I can successfully manage Greek (save/red) chars using "ya2yaml (0.30)".

Best Regards,

--
Panagiotis Atmatzidis

email: ml@convalesco.org
blog: http://www.convalesco.org

The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."

I know that Illias is probably trolling, but there is a way to get the
desired behaviour: Use Psych (https://github.com/tenderlove/psych).

roger@roger-MS-7621:~$ irb
ruby-1.9.2-p180 :001 > require "psych"
=> true
ruby-1.9.2-p180 :003 > require "yaml"
=> true
ruby-1.9.2-p180 :004 > YAML.dump("ööö")
=> "--- ööö\n...\n"

···

--
Roger Braun
rbraun.net | humoralpathologie.de

[...]

I can confirm this, as I've tried it.

But the main issue was, to enable this behaviour out-of-the-box.

As stated, it's solved now:

.

···

On 3 Ιούν, 07:26, Panagiotis Atmatzidis <m...@convalesco.org> wrote:

Hello,

On 01 Ιουν 2011, at 12:55 μ.μ., Ilias Lazaridis wrote:

> On 20 Μάϊος, 18:26, Ilias Lazaridis <il...@lazaridis.com> wrote:
>> After reading within some archives, it seems that the standard-
>> behaviour of ruby is to save utf-8 data within yaml files in this
>> form:

>> äïêéìÞ => "\x9B\xA6\xA1\xA0\xA3\xE3"

>> Is this so?

>> If yes, what is the simplest way to change this behaviour?

>> Requirements:

>> * solution should be usable for end-users
>> * solution should not require any changes within the application
>> which uses yaml

>> Example solution:

>> * gem install another-yaml-which-saves-human-readable-utf-8

> fixed for ruby 1.9.3:

> (changed default YAML from "syck" to "psych", which saves utf-8 data
> human readable)

>Bug #4758: yaml file not human readable when saving utf-8 - Ruby master - Ruby Issue Tracking System

I can successfully manage Greek (save/red) chars using "ya2yaml (0.30)".

--
http://lazaridis.com

I know that Illias is probably trolling,

Mr. Braun, I've placed a simple technical question. If someone is
"trolling", than it's not me, but those who write off-topic, off-
context and those who talk about trolling. This starts to become
annoying, mostly because it gives this medium an unprofessional touch,
which reflects negatively on ruby.

This should be avoided.

but there is a way to get the
desired behaviour: Use Psych (https://github.com/tenderlove/psych\).

roger@roger-MS-7621:~$ irb
ruby-1.9.2-p180 :001 > require "psych"
=> true
ruby-1.9.2-p180 :003 > require "yaml"
=> true
ruby-1.9.2-p180 :004 > YAML.dump("ööö")
=> "--- ööö\n...\n"

I've verified this solution, it works fine (utf-8 arrives human-
readable within the yaml file, as it should).

require "psych" // place before yaml
require "yaml"

alternative:

require "yaml"
YAML::ENGINE.yamler = "psych"

···

On 21 Μάϊος, 22:02, Roger Braun <ro...@rogerbraun.net> wrote:

-

Thanks a lot!

.

--
http://lazaridis.com