S
S
SnowDiamond2015-01-07 02:16:14
ruby
SnowDiamond, 2015-01-07 02:16:14

Ruby and Windows file encoding problem in Linux?

I create a text file in Windows with Russian letters in UTF-8 encoding. I run irb in Ubuntu and read the data from the file:
File.read("мой файл.csv")
As a result, I get krakozyabry instead of Russian words. It is necessary for me to read the given (windows) file without third-party applications in ruby ​​through ruby. Can anyone help? Already tried everything, it's useless. Respond!!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OnYourLips, 2015-01-07
@OnYourLips

irb most likely not in utf-8 works for you.
Try not in cmd, but in another console to run it.
For some time I tried to write in ruby ​​under Windows, but, IMHO, ruby ​​cannot be called a worker on Windows.
Huge performance and package installation (build) issues.
Install a virtual machine with Linux and use ruby ​​there.

V
Viktor Maslov, 2015-01-15
@Nakilon

File.read("мой файл.csv", encoding: "utf-8")
The best source for the Ruby language => bit.ly/1FZSb4U

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question