Forum: Ruby Ruby could recognize the values when putting into a webpage text filed.

Posted by Love U Ruby (my-ruby)
on 2013-02-05 07:49
Hi,

I have some values in my Excel as below:

1136-ΑΓΙΩΝ ΑΝΑΡΓΥΡΩΝ
1137-ΑΙΓΑΛΕΩ

But with script when I am putting those into a webpage filed, they are
saving into the field as below:

136-αΓ?Ω? α?α?Γ??Ω?
1137-α?Γα?εΩ


Any idea how to fix the same ?
Posted by Colby Callahan (Guest)
on 2013-02-05 09:54
(Received via mailing list)
set encoding or use a diff font package?
Posted by Love U Ruby (my-ruby)
on 2013-02-05 10:49
Colby Callahan wrote in post #1095280:
> set encoding or use a diff font package?

Didn't get you. Which package you are asking me to refer? I used 
selenium-web driver for my scripts at all.


Thanks
Posted by Love U Ruby (my-ruby)
on 2013-02-05 15:22
Can anyone help me here? This is the thing sucking my whole script to 
stop. I need to update 500 values on the webpage. I am using windows - 
XP.


Thanks
Posted by Hans Mackowiak (hanmac)
on 2013-02-05 15:25
how do you read the csv file?
have you maybe thought about that the encoding may be wrong?
what ruby version do you using?
Posted by Love U Ruby (my-ruby)
on 2013-02-05 15:28
Hans Mackowiak wrote in post #1095331:
> how do you read the csv file?
> have you maybe thought about that the encoding may be wrong?
> what ruby version do you using?

I am using Ruby 1.9.3 latest version. I am using win32ole library with 
Excel - 2010.

until number_of_list_values == 0

  number_of_list_values = number_of_list_values - 1
  element = driver.find_element :id => "codeExt"
  element.send_keys wbs.cells(rows,2).value
  element = driver.find_element :id => "descriptionExt"
  element.send_keys wbs.cells(rows,3).value
  driver.find_element(:name, "btnSaveandNew").click if 
number_of_list_values != 0
  wbs.cells(rows,5).value = "done"
  rows = rows + 1
  driver.find_element(:name, "btnSave").click if number_of_list_values 
== 0

end
Posted by Colby Callahan (Guest)
on 2013-02-05 19:37
(Received via mailing list)
I am just saying that the browser thinks the information it is receiving 
is
of encoding type X while the server/program is sending encoding type Y.
 e.g.  ruby sends UTF-8, but excel 2010 is encoded with ANSI by default 
(i
think).  This would mean that your special characters are not going to 
be
available.  Program sends I know of only two reasons why it would not be
able to properly read or display any character (not specific to ruby or 
any
language): Encoding Mismatch or Missing Fonts.  My guess is encoding. 
e.g
 This may help with checking/changing your encoding.

http://www.ruby-doc.org/core-1.9.3/Encoding.html     (checking encoding
within ruby)
http://www.surveygizmo.com/survey-software-support...
(specifically how to change excel encoding)

Hope that helps...
Posted by Love U Ruby (my-ruby)
on 2013-02-05 19:51
Colby Callahan wrote in post #1095383:
> I am just saying that the browser thinks the information it is receiving
> is
> of encoding type X while the server/program is sending encoding type Y.
>  e.g.  ruby sends UTF-8, but excel 2010 is encoded with ANSI by default
> (i
> think).  This would mean that your special characters are not going to
> be
> available.  Program sends I know of only two reasons why it would not be
> able to properly read or display any character (not specific to ruby or
> any


But in excel column those values are quite OK,only the problem is when 
program reading the excel column by the above program, something wrong 
happened. definitely it is encoding problem. So in my code doing some 
change- can you guide me?
Posted by Wayne Brisette (Guest)
on 2013-02-05 20:04
(Received via mailing list)
> But in excel column those values are quite OK,only the problem is when
> program reading the excel column by the above program, something wrong
> happened. definitely it is encoding problem. So in my code doing some
> change- can you guide me?


Do you ever read ANY of the links people provide?

I'm sure I'm not the only one, but why is it you seem to want people to 
spoon
feed you everything? You're right, you have an encoding issue.

You have some sample Excel data that comes into Ruby incorrectly, so now 
try
stuff! Go read the encoding links provided, you'll find there's a very 
elegant
way in Ruby to take the existing encoding and change it. Run a few 
tests.
Reencode the incoming string with multiple encoding methods. Look at the 
output,
When you see the one that fixes your issue you'll know exactly what to 
do.

Wayne
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.