I’ve started a new project in Ruby. For once, my sourcecode is not in
English, but in French, and I’d like to know if its possible to have
accentuated letters for function names in the sourcecode.
I have encoded my file in UTF-8 and it is parsed fine on Linux, but on
Windows, I get warnings and errors:
main.rb:16: Invalid char `\303’ in expression
Is there a way to specify sourcefile encoding? I could drop the accents
in the source, but they make the code much more readable!
IMHO it is generally a good idea to stick with 7 bit ASCII in source
code. Also, I would never use my mother tongue for source code,
partly because keywords are English anyway (even though Matz is
Japanese) and partly because English is the lingua franca of IT. I
know, this is not what you wanted to hear.
IMHO it is generally a good idea to stick with 7 bit ASCII in source
code. Also, I would never use my mother tongue for source code,
partly because keywords are English anyway (even though Matz is
Japanese) and partly because English is the lingua franca of IT. I
know, this is not what you wanted to hear.
Thanks for your answer!
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: --
I’m sure there’s a way to do that in Ruby as well, but couldn’t find it
anywhere
in a solution.
Ne te laisse pas dominer par le langage ! La solution c’est de passer
de MatzacredLisp à Common Lisp (par exemple: http://clisp.cons.org) :
In Python you can define the file encoding in some kind
of file header:
#!/usr/bin/python
# -- coding: --
I’m sure there’s a way to do that in Ruby as well, but couldn’t find it
anywhere
AFAIK, python doesn’t use that line.
It’s emacs that uses to store buffer local variables.
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: --
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.