Note that there are some explanatory texts on larger screens.

plurals
  1. POMake Ruby 1.9 regard all source files to be UTF-8 encoded. (Even if recompiling the interpreter is necessary)
    primarykey
    data
    text
    <p>I want to port a rails app from Ruby 1.8.7 to 1.9.2. Some of the files contain umlauts like ä/ö/ü both within strings and comments. The files were saved as UTF-8 but without a <a href="http://en.wikipedia.org/wiki/Byte_order_mark" rel="noreferrer">BOM</a> (byte order mark) at the beginning. </p> <p>As you might know, <a href="http://ruby.runpaint.org/encoding#source" rel="noreferrer">Ruby 1.9 refuses to parse these files</a>, giving an <code>invalid multibyte char (US-ASCII)</code></p> <p>I was googling and reading a lot but the only solution to this seems to be to</p> <ul> <li>insert a BOM or</li> <li>insert <code># coding: utf-8</code></li> </ul> <p>at the beginning of <em>each</em> file.</p> <p>My editor of choice (gEdit) doesn't seem to insert a BOM. I also read that having a BOM is bad practice because it may break some editors, it also breaks shell scripts if you want to use the shebang notation.</p> <p><strong><em>EDIT</strong>: The BOM breaks the Ruby 1.8.7 parser, giving a <code>syntax error, unexpected kEND, expecting $end (SyntaxError)</code> for the file!</em> </p> <p>I tried forcing the external encoding with ruby -Eutf-8:utf-8 but this seems to be ignored when calling rake (I tried: /home/malte/.rvm/gems/ruby-1.9.2-p180/bin/rake test).</p> <p>So my question is:</p> <p>As RVM is building ruby 1.9 from source anyway, <strong>is there a build option or a patch to change the default encoding from US-ASCII to UTF-8</strong>?</p> <p>I took a quick look at the source code but couldn't find the line where the default is set (I'm no C expert, tough).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload