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