Non-ASCII strings coming out as?

Howdy!

First off, I apologize if this has been answered elsewhere. This is one
of those topics that is surprisingly hard to draft a search engine
friendly query for!

I’m running a Ruby script within my Java app, using a
ScriptingContainer. My Ruby script fills out a template using ERB,
calling back to the Java side to get the occasional data string. I’m
running into problems when the string returned from the Java side is
non-ASCII - I just get a ‘?’ for each character I’m expecting. I know
there are differences between the way Ruby 1.8 and 1.9 handle multibyte
characters, so I figured the problem would be fixed if I were using 1.9.
I included a call to setCompatVersion(CompatVersion.RUBY1_9) before I
run my script, but I’m seeing the same behavior.

Any help or advice?

Many thanks!

–Andy

Hello,

On Tue, Sep 6, 2011 at 7:24 PM, Andy I. [email protected] wrote:

non-ASCII - I just get a ‘?’ for each character I’m expecting. I know
there are differences between the way Ruby 1.8 and 1.9 handle multibyte
characters, so I figured the problem would be fixed if I were using 1.9.
I included a call to setCompatVersion(CompatVersion.RUBY1_9) before I
run my script, but I’m seeing the same behavior.

Usually, getting '?'s instead of readable characters means incorrect
encoding was applied when unicode was decoded.

Do you have a simple reproduce-able code?

-Yoko