I
I
iMa3str02015-02-19 13:52:22
ruby
iMa3str0, 2015-02-19 13:52:22

How to fix encoding error (IBM866 and ASCII-8BIT)?

How to remove an encoding error when Russian characters appear in file records? (Error: incompatible character encodings: IBM866 and ASCII-8BIT)
If there are no Russian letters in the files, then everything works fine.
Here is the content of the app.rb files

get '/controlpanel' do
  @file_visitors = File.read('./public/visitors.txt')
  @file_contacts = File.read('./public/contacts.txt')
  erb :controlpanel
end

This is controlpanel.erb
<html>
<head>
</head>
<body>
<h2>Панель управления</h2>
<div>
<% @file_visitors.each_line do |line| %>
  <%= line %>
<% end %>

<% @file_contacts.each_line do |line| %>
  <%= line %>
<% end %>
</div>

</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-02-19
@iMa3str0

stackoverflow.com/questions/11664403/does-ruby-pro...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question