Improve string encoding #113

merged 3 commits into from Jan 6, 2013


2 participants

pck commented Jan 6, 2013


I think psych must not assume that the encoding of a String has a semantic meaning. Usually Strings are treated identically if they contain the same characters, even if the encoding is different.

Subclasses of Strings were not dumped if they changed the encoding. I added a simple test and fixed the error, but better tests may be required.

Regards, Paul

pck added some commits Jan 6, 2013

Changed Psych::Visitors::YAMLTree.binary?(string).
* A human-readable representation can be used for ascii_only 8bit-encoded strings.
* String subclasses are binary, even if they are character-encoded.

tenderlove commented Jan 6, 2013

Looks good, thanks!

tenderlove added a commit that referenced this pull request Jan 6, 2013

@tenderlove tenderlove merged commit 4f403bc into ruby:master Jan 6, 2013

1 check passed

default The Travis build passed

@pck pck deleted the pck:improve-string-encoding branch Jan 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment