diff options
author | Mark Spruiell <mes@zeroc.com> | 2017-10-26 16:29:09 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2017-10-26 16:29:09 -0700 |
commit | 31a33adda8c19296d2a6a49b2c652964279807d8 (patch) | |
tree | a6c123ceb4ed7033fe0a30d99429a3b9bbf4b33a /ruby/src | |
parent | ICE-8545 - add test for python package metadata (diff) | |
download | ice-31a33adda8c19296d2a6a49b2c652964279807d8.tar.bz2 ice-31a33adda8c19296d2a6a49b2c652964279807d8.tar.xz ice-31a33adda8c19296d2a6a49b2c652964279807d8.zip |
ICE-8457 - Ruby and Python string fixes
Diffstat (limited to 'ruby/src')
-rw-r--r-- | ruby/src/IceRuby/Types.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 799c8197ab7..ea018cd839b 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -618,7 +618,11 @@ IceRuby::PrimitiveInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap*, bool case PrimitiveInfo::KindString: { string val = getString(p); - os->write(val); +#ifdef HAVE_RUBY_ENCODING_H + os->write(val, false); // Bypass string conversion. +#else + os->write(val, true); +#endif break; } } @@ -683,7 +687,11 @@ IceRuby::PrimitiveInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackP case PrimitiveInfo::KindString: { string str; - is->read(str); +#ifdef HAVE_RUBY_ENCODING_H + is->read(str, false); // Bypass string conversion. +#else + is->read(str, true); +#endif val = createString(str); break; } @@ -1517,7 +1525,11 @@ IceRuby::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, VALU { seq[i] = getString(RARRAY_AREF(arr, i)); } - os->write(&seq[0], &seq[0] + seq.size()); +#ifdef HAVE_RUBY_ENCODING_H + os->write(&seq[0], &seq[0] + seq.size(), false); // Bypass string conversion. +#else + os->write(&seq[0], &seq[0] + seq.size(), true); +#endif break; } } @@ -1643,7 +1655,11 @@ IceRuby::SequenceInfo::unmarshalPrimitiveSequence(const PrimitiveInfoPtr& pi, Ic case PrimitiveInfo::KindString: { Ice::StringSeq seq; +#ifdef HAVE_RUBY_ENCODING_H + is->read(seq, false); // Bypass string conversion. +#else is->read(seq, true); +#endif long sz = static_cast<long>(seq.size()); result = createArray(sz); |