Skip to content

Instantly share code, notes, and snippets.

@edward
Created October 19, 2013 14:40
Show Gist options
  • Select an option

  • Save edward/7056775 to your computer and use it in GitHub Desktop.

Select an option

Save edward/7056775 to your computer and use it in GitHub Desktop.
if ((rb_enc_asciicompat(to) && is_ascii_string(str)) ||
to == rb_ascii8bit_encoding()) {
if (STR_ENC_GET(str) != to) {
str = rb_str_dup(str);
rb_enc_associate(str, to);
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment