Last Updated: February 25, 2016
·
1.69K
· renegr

Passing umlaut to system calls using jruby-1.7.4

I recently discovered that writing ...

result = `program 'Parameter mit Umlaut äü'`

... will work just fine in ruby-2, but when moving to jruby-1.7.4 it will mess up the umlaut in the parameters. The solution is pretty simple - just use IO::popen like so:

p = IO::popen("program 'Parameter mit Umlaut äü'", :external_encoding => "UTF-8")
result = p.read