Problem with utf-8 when import from Excel to Textbox field

13 views
Skip to first unread message

Quang

unread,
Sep 15, 2010, 4:10:31 AM9/15/10
to Vapir
Hi Ethan,
Vapir was already works very good with utf-8.
But i have a problem when read data utf-8 from excel

myscript.rb
----------------------------------------------------------------------------------------------------
require 'rubygems'
require 'win32ole'
require 'vapir-firefox'

$ff = Vapir::Firefox.start("www.google.com")

$excel = WIN32OLE.new("excel.application")
$excel.visible = true
$workbook = $excel.workbooks.open("#{getPathExe}HpTel.xls")
$ws=$workbook.worksheets(1)
$workbook = $excel.ActiveWorkbook
s = "Năng động mỗi ngày"
$ff.text_field(:name,'q').value = s # good
$ff.text_field(:name,'q').value = $ws.range("e5").value #not work
------------------------------------------------------------------------------------------------------

Help me!!! plz

Ethan

unread,
Sep 15, 2010, 9:39:21 AM9/15/10
to va...@googlegroups.com
After you require win32ole, set the codepage to utf8:

require 'win32ole'
WIN32OLE.codepage = WIN32OLE::CP_UTF8

If that doesn't fix it, I don't know any other possibility - win32ole itself is beyond my ability to support. hope that helps. 

-Ethan

Quang

unread,
Sep 15, 2010, 8:39:41 PM9/15/10
to Vapir
Thanks for your help, actually it doesn't work.

On Sep 15, 8:39 pm, Ethan <notet...@gmail.com> wrote:
> After you require win32ole, set the codepage to utf8:
>
> require 'win32ole'
> WIN32OLE.codepage = WIN32OLE::CP_UTF8
>
> If that doesn't fix it, I don't know any other possibility - win32ole itself
> is beyond my ability to support. hope that helps.
>
> -Ethan
>
Reply all
Reply to author
Forward
0 new messages