Annoying: cannot write ' user=" Iñaki ' in a Ruby1.9 script

Hi, I'm really annoyed, please try this:

Open a file (in a UTF-8 system as any modern Linux) and write:

script.rb

···

--------------------
user = "Iñaki"
puts user
--------------------

Now run:

~# ruby1.8 script.rb
=> "Iñaki"

~# ruby1.9 script.rb
=> invalid multibyte char (US-ASCII)

I'm using the last 1.9 version: ruby-1.9.1-p129

How can it be possible? Of course, the file "script.rb" is encoded in UTF-8,
sure.

--
Iñaki Baz Castillo <ibc@aliax.net>

That is not the last, but it also occurs with 1.9.1-p243.

···

El Miércoles, 2 de Septiembre de 2009, Iñaki Baz Castillo escribió:

I'm using the last 1.9 version: ruby-1.9.1-p129

--
Iñaki Baz Castillo <ibc@aliax.net>

How about:

# encoding: utf-8
user = "Iñaki"
puts user

···

On Tue, Sep 1, 2009 at 7:13 PM, Iñaki Baz Castillo<ibc@aliax.net> wrote:

Hi, I'm really annoyed, please try this:

Open a file (in a UTF-8 system as any modern Linux) and write:

script.rb
--------------------
user = "Iñaki"
puts user
--------------------

~# ruby1.9 script.rb
=> invalid multibyte char (US-ASCII)

How can it be possible? The file "script.rb" is encoded in UTF-8

I confirm this script also fails with 1.9.1-p243 on Mac OS X 10.5.8.

That's pretty terrible. Can anyone explain what the problem is?

···

On Sep 1, 4:15 pm, Iñaki Baz Castillo <i...@aliax.net> wrote:

El Miércoles, 2 de Septiembre de 2009, Iñaki Baz Castillo escribió:

> I'm using the last 1.9 version: ruby-1.9.1-p129

That is not the last, but it also occurs with 1.9.1-p243.

Yes, that works... but I cannot figure why is this required. I use a system
in UTF-8 so the file is encoded in UTF-8. Also Ruby1.9 seems to work in UTF-8
by default:

"abc".encoding
=> #<Encoding:UTF-8>

so...?

Thanks for your reply.

···

El Miércoles, 2 de Septiembre de 2009, brabuhr@gmail.com escribió:

On Tue, Sep 1, 2009 at 7:13 PM, Iñaki Baz Castillo<ibc@aliax.net> wrote:
> Hi, I'm really annoyed, please try this:
>
> Open a file (in a UTF-8 system as any modern Linux) and write:
>
> script.rb
> --------------------
> user = "Iñaki"
> puts user
> --------------------
>
> ~# ruby1.9 script.rb
> => invalid multibyte char (US-ASCII)
>
> How can it be possible? The file "script.rb" is encoded in UTF-8

How about:

# encoding: utf-8
user = "Iñaki"
puts user

--
Iñaki Baz Castillo <ibc@aliax.net>

Yes, that works... but I cannot figure why is this required. I use a
system
in UTF-8 so the file is encoded in UTF-8. Also Ruby1.9 seems to work in
UTF-8
by default:

See

Thanks:

"The first is the main rule of source Encodings: source files receive
a US-ASCII Encoding, unless you say otherwise"

···

2009/9/2 John W Higgins <wishdev@gmail.com>:

Yes, that works... but I cannot figure why is this required. I use a
system
in UTF-8 so the file is encoded in UTF-8. Also Ruby1.9 seems to work in
UTF-8
by default:

See
Gray Soft / Not Found

--
Iñaki Baz Castillo
<ibc@aliax.net>