Search code examples
ruby-on-railsrubybashmediainfo

Calling Bash Commands From Ruby with russian symbols return 1


Calling bash command

cmd = '/usr/bin/mediainfo "/var/avalon/dropbox/Лекции_для_молодых_ученых/Nabiullin_SciERes_1.flv" --Output=XML'    
out = `#{cmd}`

In rails project 'avalom media system' return error code 1.

Removal of russian letters out of the path cmd = '/usr/bin/mediainfo "/var/avalon/dropbox/Nabiullin_SciERes_1.flv" --Output=XML' , a call to another command cmd = 'head "/var/avalon/dropbox/Лекции_для_молодых_ученых/Nabiullin_SciERes_1.flv"' or run the command in irb or project environment or bash - everything is fine.

Thx.

Error when i try add media file to collection with russian letters in file:543 => in gem media info file:473

Console encoding - utf-8. Command string encoding - utf-8.


Solution

  • The cause of this problem is that ENV["LANG"] of avalon is C. Set ENV["LANG"] to en_US.utf-8 resolve this trouble.