Ollivier Robert
12/15/2008 1:48:00 PM
In article <91991a7c6c47ae31b3de62a62d015d4c@ruby-forum.com>,
Jean-baptiste Hétier <djib.nospam@think-underground.com> wrote:
>Yeah, I'll probably switch back to English... but I'm still interested
>in a solution. In Python you can define the file encoding in some kind
>of file header:
> #!/usr/bin/python
> # -*- coding: <encoding name> -*-
As it was already said, 1.9 does support the Encoding string but for 1.8, you may want to try adding "-Ku" to your Ruby invocation.
395 [14:46] roberto@roberto-al:/tmp> ruby -Ku foo.rb
Bonjour
396 [14:46] roberto@roberto-al:/tmp> cat foo.rb
#! /opt/local/bin/ruby -Ku
#
def été(foo)
puts(foo)
end
été("Bonjour")
With foo.rb written with utf-8 encoding.
--
Ollivier ROBERT -=- EEC/RIF/SEU -=-
Systems Engineering Unit