diff options
Diffstat (limited to 'rb/src/IceRuby/Util.cpp')
-rw-r--r-- | rb/src/IceRuby/Util.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rb/src/IceRuby/Util.cpp b/rb/src/IceRuby/Util.cpp index 0674c80f352..e842e1bb67e 100644 --- a/rb/src/IceRuby/Util.cpp +++ b/rb/src/IceRuby/Util.cpp @@ -11,6 +11,10 @@ #include <Ice/LocalException.h> #include <stdarg.h> +#ifdef HAVE_RUBY_ENCODING_H +# include <ruby/encoding.h> +#endif + using namespace std; using namespace IceRuby; @@ -106,7 +110,11 @@ IceRuby::getString(VALUE val) VALUE IceRuby::createString(const string& str) { +#ifdef HAVE_RUBY_ENCODING_H + return callRuby(rb_enc_str_new, str.c_str(), static_cast<long>(str.size()), rb_utf8_encoding()); +#else return callRuby(rb_str_new, str.c_str(), static_cast<long>(str.size())); +#endif } long |