(unknown)

Hi,

I am using win32ole for excel-automation. Currently I need to cope with a
spreadsheet containing cyrillic characters.

The following excample code demonstrates my problem:

  require 'win32ole'
  x = WIN32OLE.new "Excel.Application"
  x.workbooks.open "sheetwithcyrillicwords.xls"

  # this field contains a russian word
  x.range("A1").value # => "???"

It would be great if someone could help me find a way to get the right
values in ruby.

Thanks for your help,
jochen

Ruby is probably returning the right values, but you're not displaying
them in Unicode. If you're running on the console, type this before
running your program:

chcp 65001

This will enable the console to behave in UTF-8 mode, which should work.

It would also help if you can see the internal representation of the value:

  puts x.range("A1").value.inspect

-austin

···

On Mon, 14 Feb 2005 19:25:27 +0900, Jochen Immendoerfer <jo@h0me.homelinux.net> wrote:

Hi,

I am using win32ole for excel-automation. Currently I need to cope with a
spreadsheet containing cyrillic characters.

The following excample code demonstrates my problem:

  require 'win32ole'
  x = WIN32OLE.new "Excel.Application"
  x.workbooks.open "sheetwithcyrillicwords.xls"

  # this field contains a russian word
  x.range("A1").value # => "???"

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Austin Ziegler <halostatue <at> gmail.com> writes:

Ruby is probably returning the right values, but you're not displaying
them in Unicode. If you're running on the console, type this before
running your program:

chcp 65001

This will enable the console to behave in UTF-8 mode, which should work.

It would also help if you can see the internal representation of the value:

  puts x.range("A1").value.inspect

-austin

Hi Austin,

thanks for your answer.

I tried your suggestion, but unfortunately I still get the same result. Even
after changing the codepage the output of

  puts x.range("A1").value.inspect

remains

  "???"
.

For me it looks like as if win32ole is not able to handle the charset.

Any further ideas?

regards,
jochen

This looks to be a bug. I couldn't get it to work with 日本語, regardless
of the setting of KCODE. I'm not sure if it's a Win32 installer bug or
a Ruby Win32OLE bug. Are you able to build this yourself or can you
try the alternative version (sorry, I don't have a link). It may also
be worth visiting the RubyForge project and reporting Ruby bugs there.

-austin

···

On Tue, 15 Feb 2005 02:33:39 +0900, Jochen Immendoerfer <jo@h0me.homelinux.net> wrote:

For me it looks like as if win32ole is not able to handle the charset.
Any further ideas?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Austin Ziegler <halostatue <at> gmail.com> writes:

> For me it looks like as if win32ole is not able to handle the charset.
> Any further ideas?

This looks to be a bug. I couldn't get it to work with 日本語, regardless
of the setting of KCODE. I'm not sure if it's a Win32 installer bug or
a Ruby Win32OLE bug. Are you able to build this yourself or can you
try the alternative version (sorry, I don't have a link). It may also
be worth visiting the RubyForge project and reporting Ruby bugs there.

-austin

I built ruby with cygwin from source and experienced the same behaviour. Looks
like it's not a one-click-ruby bug but a WIN32OLE bug. I'm going to submit a bug
report at rubyforge.

Thanks for your help!

jochen

···

On Tue, 15 Feb 2005 02:33:39 +0900, Jochen Immendoerfer > <jo <at> h0me.homelinux.net> wrote:

No problem. I'm just surprised you could do anything with cygwin/ruby
-- I thought it couldn't do WIN32OLE stuff at all.

-austin

···

On Tue, 15 Feb 2005 19:23:56 +0900, Jochen Immendoerfer <jo@h0me.homelinux.net> wrote:

Austin Ziegler <halostatue <at> gmail.com > writes:
> On Tue, 15 Feb 2005 02:33:39 +0900, Jochen Immendoerfer > > <jo <at> h0me.homelinux.net > wrote:
> > For me it looks like as if win32ole is not able to handle the charset.
> > Any further ideas?
> This looks to be a bug. I couldn't get it to work with 日本語, regardless
> of the setting of KCODE. I'm not sure if it's a Win32 installer bug or
> a Ruby Win32OLE bug. Are you able to build this yourself or can you
> try the alternative version (sorry, I don't have a link). It may also
> be worth visiting the RubyForge project and reporting Ruby bugs there.
I built ruby with cygwin from source and experienced the same behaviour. Looks
like it's not a one-click-ruby bug but a WIN32OLE bug. I'm going to submit a bug
report at rubyforge.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Austin Ziegler <halostatue <at> gmail.com> writes:

No problem. I'm just surprised you could do anything with cygwin/ruby
-- I thought it couldn't do WIN32OLE stuff at all.

As far as I know there's nothing you can't do with cygwin/ruby but with native
win32-ruby.

jochen