When creating string bindings, use String#force_encoding, instead of String#encode, via the force_string_encoding property.
My intent here is to allow the writing of UTF-8 strings to legacy encoding types without monkey-patching ruby-oci8.
Backstory: we have a large, old Oracle database with ASCII encoding. It's huge and Oracle is deprecated for us, so we're not taking on the maintenance to move these to UTF-8. What we've done instead is patch ruby-oci8 so we can persist our escaped UTF-8 strings in ASCII, then use ActiveSupport::Multibyte#tidy_bytes to convert them back to UTF-8 on read.
I know this is probably an uncommon need at this point, so if there isn't sufficient utility in such a flag or there are other reasons not to add such a feature, let me know.
When creating string bindings, use
String#force_encoding
, instead ofString#encode
, via theforce_string_encoding
property.My intent here is to allow the writing of UTF-8 strings to legacy encoding types without monkey-patching
ruby-oci8
.Backstory: we have a large, old Oracle database with ASCII encoding. It's huge and Oracle is deprecated for us, so we're not taking on the maintenance to move these to UTF-8. What we've done instead is patch
ruby-oci8
so we can persist our escaped UTF-8 strings in ASCII, then use ActiveSupport::Multibyte#tidy_bytes to convert them back to UTF-8 on read.I know this is probably an uncommon need at this point, so if there isn't sufficient utility in such a flag or there are other reasons not to add such a feature, let me know.