From: Alex Fenton Date: 2008-02-28T00:39:55+09:00 Subject: Re: Unicode strings in ruby code Idan Miller wrote: > This code: > > a = "א" > > that I write using SciTE and saved as UTF-8 gives these errors: > C:/Documents and Settings/idan/Desktop/test.rb:1: Invalid char `\357' > in expression > C:/Documents and Settings/idan/Desktop/test.rb:1: Invalid char `\273' > in expression > C:/Documents and Settings/idan/Desktop/test.rb:1: Invalid char `\277' > in expression > > Now, if I save this as ANSI in SciTE it allows it, and then it runs. The problem is partly because you're using SCITE. It's saves the "Byte Order Mark" or BOM at the beginning of UTF-8 files. Ruby fails to run scripts with a BOM at the beginning. The solution is to find a setting to save UTF8 without BOM. I don't know how it's done in SCITE, but any decent code editor should be able to do this. If, not find another. As others have said, you should puts $KCODE='u' or run ruby with -Ku if your script is encoded in UTF8. alex