ruby `encode': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) -


There are strange characters in Hannibal episodes in TVDB.

For example:

  one? Uf   

Then Ruby spits out:

  ./ manifesto.rb: 19: In 'encode': "\ xC3" from ASCII-8 BIT to UTF -8 (encoding :: unchanged conversion version) from ./manifesto.rb: 19: in` to_json './manifesto.rb:19:in` & lt; Main & gt; '   

line is 19:

  enters @ tree.to_json   

Does anyone dealing with these non The way is the UTF character? I could not change them, but changed them? Or will you ignore them? I do not know, any help appreciated.

The strange part is that running this script works fine by Cron manually generates this error.

It seems that you should use other encoding for the object. Instead of using @ tree.force_encoding ('ISO-8859-1') , you should set the appropriate codepage to variable @tree . Because ASCIII-8 BIT is used only for binary files.

To find the existing external encoding for Ruby, issue:

  encoding.default_external   

If the problem is resolved If the problem is in the default codepage (encoding), you need to set the proper default codepage (encoding) from either to:

  1. Change the encoding For Ruby or any other appropriate form, do the following:

      encoding.default_exnet = In:  grep  current valid set up:  
      $ sudo env: encoding :: UTF_8          | Grep UTF-8 LC_ALL = ru_RU.UTF-8 LANG = Ru_RU.UTF-8   

    Then set them in .bashrc properly, in the same way, But not exactly with ru_RU language, such as:

      export LC_ALL = ru_RU.UTF-8 export LANG = ru_RU.UTF-8      

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -