Hi,
does this no longer work?
···
--------------------
#!/usr/bin/env ruby
# -*- coding: UTF-8 -*-
puts $KCODE
puts "äöüÄÖÜß"
--------------------
I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
What do I miss?
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
That didn't work for me under Windows.
Can you add -Ku to the shebang line? That did work for me.
Jason
···
On 5/9/05, Bertram Scharpf <lists@bertram-scharpf.de> wrote:
Hi,
does this no longer work?
--------------------
#!/usr/bin/env ruby
# -*- coding: UTF-8 -*-
puts $KCODE
puts "äöüÄÖÜß"
--------------------
I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
What do I miss?
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
Hi!
does this no longer work?
You forgot to define the meaning of 'no longer works':
- What precisely do you mean by 'it works'?
- What is the reference to compare to?
- Did you switch to a different terminal emulation or change your
terminal emulation's settings since 'it works'?
--------------------
#!/usr/bin/env ruby
# -*- coding: UTF-8 -*-
puts $KCODE
puts "äöüÄÖÜß"
--------------------
I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
What do I miss?
I wrote the scriptlet to deppian.rb; ruby deppian.rb results in:
NONE
äöüÄÖÜß
NONE
äöüÃÃÃÃ
or even more alien results. The former is for a utf-8 terminal, the
latter for an iso-8859-1 terminal.
When in doubt *set* $KCODE explicitly.
Note that the above quote has been converted from utf-8 to iso-8859-1
to avoid artefacts resulting from mixed use of iso-10646 and iso-8859
- fortunately 'wanderlust' does not choose the charset without askign
the user to accept the choice.
Josef 'Jupp' SCHUGT
···
At Tue, 10 May 2005 06:58:30 +0900, Bertram Scharpf wrote:
--
Zehn von zehn Unix-Nutzern bestätigen... *röchel*... Neun von neun
Unix-Benutzern bestätigen: Unix *ist* benutzerfreundlich (in Anlehnung
an einen Werbespot für Fisherman's Friend).
Hi,
> does this no longer work?
>
> --------------------
> #!/usr/bin/env ruby
> # -*- coding: UTF-8 -*-
>
> puts $KCODE
> puts "äöüÄÖÜß"
> --------------------
>
> I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
> What do I miss?
(Outputs "None" and "äöüÄÖÜß".)
That didn't work for me under Windows.
Can you add -Ku to the shebang line? That did work for me.
That's exactly the problem. Only the first of these both works:
#!/usr/local/bin/ruby -Ku
#!/usr/bin/env ruby -Ku
So, I came to
<http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/4192>\.
But it doesn't seem to work here and I cannot find anything
in the source code.
Bertram
···
Am Dienstag, 10. Mai 2005, 07:34:30 +0900 schrieb Jason Foreman:
On 5/9/05, Bertram Scharpf <lists@bertram-scharpf.de> wrote:
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
Hi,
> does this no longer work?
You forgot to define the meaning of 'no longer works':
- What precisely do you mean by 'it works'?
Sorry, that was not actually elaborate. Now I think it
never worked at all.
> --------------------
> #!/usr/bin/env ruby
> # -*- coding: UTF-8 -*-
>
> puts $KCODE
> puts "äöüÄÖÜß"
> --------------------
>
> I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
> What do I miss?
In the meantime I received an answer in ruby-core and it
seems Matz just _planned_ to implement it but didn't have
the time yet.
The problem arises when my program is run on SuSE Linux
where the default encoding is UTF-8.
A better way to test in which encoding you reside is:
"ä" =~ /./
puts $&.length
This gives 1 in `None' and 2 in `UTF-8'.
When in doubt *set* $KCODE explicitly.
This has no influence on how the source code is read. The
string "Ã" produces an error when `ruby -Ku' is called.
Of course I should have written "\xc3\xa4" and "\xc3".
Sorry again for the noise.
Bertram
···
Am Freitag, 13. Mai 2005, 04:34:00 +0900 schrieb Josef 'Jupp' SCHUGT:
At Tue, 10 May 2005 06:58:30 +0900, Bertram Scharpf wrote:
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
Bertram Scharpf wrote:
Hi,
does this no longer work?
You forgot to define the meaning of 'no longer works':
- What precisely do you mean by 'it works'?
Sorry, that was not actually elaborate. Now I think it
never worked at all.
--------------------
#!/usr/bin/env ruby
# -*- coding: UTF-8 -*-
puts $KCODE
puts "äöüÄÖÜß"
--------------------
I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
What do I miss?
In the meantime I received an answer in ruby-core and it
seems Matz just _planned_ to implement it but didn't have
the time yet.
The problem arises when my program is run on SuSE Linux
where the default encoding is UTF-8.
A better way to test in which encoding you reside is:
"ä" =~ /./
puts $&.length
This gives 1 in `None' and 2 in `UTF-8'.
When in doubt *set* $KCODE explicitly.
This has no influence on how the source code is read. The
string "Ã" produces an error when `ruby -Ku' is called.
Of course I should have written "\xc3\xa4" and "\xc3".
Is this the only way to handle strings UTF-8 in ruby?
Sorry again for the noise.
Bertram
regards
jonas
···
Am Freitag, 13. Mai 2005, 04:34:00 +0900 schrieb Josef 'Jupp' SCHUGT:
At Tue, 10 May 2005 06:58:30 +0900, Bertram Scharpf wrote:
No, it is perfectly possible to use utf-8 encoded source-files. (But
you should use ruby -Ku then).
But some UTF-8 things are a bit weird. E.g. the length of an UTF-8
String is the length of its bytes not the number of characters, so I
had to write my own utf-8_length routine.
regards,
Brian
···
On 13/05/05, Jonas Hartmann <Mail@jonas-hartmann.com> wrote:
Bertram Scharpf wrote:
> Hi,
>
> Am Freitag, 13. Mai 2005, 04:34:00 +0900 schrieb Josef 'Jupp' SCHUGT:
>
>>At Tue, 10 May 2005 06:58:30 +0900, Bertram Scharpf wrote:
>>
>>>does this no longer work?
>>
>>You forgot to define the meaning of 'no longer works':
>>
>> - What precisely do you mean by 'it works'?
>
>
> Sorry, that was not actually elaborate. Now I think it
> never worked at all.
>
>
>>>--------------------
>>>#!/usr/bin/env ruby
>>># -*- coding: UTF-8 -*-
>>>
>>>puts $KCODE
>>>puts "äöüÄÖÜß"
>>>--------------------
>>>
>>>I tried it with Ruby 1.8.2 and 1.9, Debian Linux.
>>>What do I miss?
>
>
> In the meantime I received an answer in ruby-core and it
> seems Matz just _planned_ to implement it but didn't have
> the time yet.
>
> The problem arises when my program is run on SuSE Linux
> where the default encoding is UTF-8.
>
> A better way to test in which encoding you reside is:
>
> "À" =~ /./
> puts $&.length
>
> This gives 1 in `None' and 2 in `UTF-8'.
>
>
>>When in doubt *set* $KCODE explicitly.
>
>
> This has no influence on how the source code is read. The
> string "Ã" produces an error when `ruby -Ku' is called.
>
> Of course I should have written "\xc3\xa4" and "\xc3".
Is this the only way to handle strings UTF-8 in ruby?
>
> Sorry again for the noise.
>
> Bertram
>
>
regards
jonas
--
http://ruby.brian-schroeder.de/
Stringed instrument chords: http://chordlist.brian-schroeder.de/