[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Austin Ziegler

2/14/2005 3:41:00 PM

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 # => "???????"

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
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


5 Answers

Jochen Immendoerfer

2/14/2005 5:34:00 PM

0

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

"???????"

Austin Ziegler

2/14/2005 8:17:00 PM

0

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?

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
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca



Jochen Immendoerfer

2/15/2005 10:24:00 AM

0

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.
>
> -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



Austin Ziegler

2/15/2005 1:07:00 PM

0

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.

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

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



Jochen Immendoerfer

2/15/2005 1:36:00 PM

0

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