Skip to content

Instantly share code, notes, and snippets.

Avatar

Timothy Garnett tgarnett

View GitHub Profile
@tgarnett
tgarnett / Ruby-2.0.0-p0-String-Strip-Unicode-Support-Patch.patch
Last active Dec 14, 2015
Strip and associated methods in ruby 1.9.2 + (including 1.9.3 and 2.0.0) don't remove leading or trailing non-ascii white space (such as unicode ideographic space or unicode non-breaking space). This is a change from ruby 1.9.1 where these were removed. These space characters are recognized by /[[:space:]]/. This patch (for 2.0.0) restores the 1…
View Ruby-2.0.0-p0-String-Strip-Unicode-Support-Patch.patch
--- a/string.c 2013-05-04 10:44:37.201664309 -0400
+++ b/string.c 2013-05-04 11:06:36.660207151 -0400
@@ -6802,7 +6802,7 @@ rb_str_lstrip_bang(VALUE str)
int n;
unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
- if (!rb_isspace(cc)) break;
+ if (!rb_enc_isspace(cc, enc)) break;
s += n;
}