--
Wolfgang NŠŇasi-Donner
wonado / donnerweb.de
"Peter C" <pkchau / gmail.com> schrieb im Newsbeitrag
news:2c9220c5.0503150920.6eedfbc9 / posting.google.com...
> I'm working with Japanese character sets in Windows. I can save my
> *.rb files with notepad using UTF-8 but I can't run them with Ruby.
> This is what happens when I try to run it.
>
> c:\> ruby -Ku myFile.rb
> jpn.rb:1: undefined method `&#8745;&#9559;&#9488;' for main:Object
> (NoMethodError)
>
>
> Am I doing something wrong?
>
> My goal is the read/write strings (containing Japanese characters)
> from a web browser. Is there a recommend way of doing this?
>
> Peter

The Windows-Editor writes always a "Byte Order Mark" (BOM) at the beginning
of UTF-8/16LE/16BE coded files. In this case a UTF-8 coded file begins with
"EF BB BF" (hex). These non-characters should usually be ignored (for more
information see http://www.unicode.org/).

One possibility is to remove the first three bytes of the UTF-8 encoded file
using some filter program or a hex editor. You should do this into a copy,
because the Windows editor cannot work correctly on this changed data :-((