Getting error "incompatible character encodings"

Hi,

I have ruby 1.9.2 installed.

I have script which is created for utf8 data.

I have to use netssh also to send commands having utf8 data to remote
computers. For this to work i have to use force encoding to ASCII-8BIT.

But after this rest of the places in script have utf8 data but after
this netssh command get executed rest of the script failed with for
incompatible encoding.

# encoding: utf-8

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../..') if $0 ==
__FILE__

require 'Lib/KazeonCommon/BasicMethodLibrary'
require 'Lib/KazeonCommon/WebAutosetup.rb'

class TC_I18N < Test::Unit::TestCase

  def setupnew(current_component="")
    $ie.close if $ie
        sleep($deepSleep)
        $ie = Watir::IE.new()
        sleep($shortSleep)
  case current_component

      when "WEB_ADMIN"
        $ie.goto($adminLink)

      when "WEB_REPORT"
        $ie.goto($reportLink)

      when "WEB_SEARCH"
        $ie.goto($searchLink)

      when "LEGALUI"
        $ie.goto($legalLink)

      else
        #puts "setupnew case does not match"
  end
  end

def test_0001
    printTestCaseInfo("I18N_0055", "Add Identity from GUI, for FIGS.")
    printTestCaseInfo("I18N_0001", "Add AD Authentication from
Webadmin, for FIGS.")
          setupnew("WEB_ADMIN")
          skipSecurity("Continue to this website")
          kazeonLegalLogin("WEB_ADMIN", "ES1FR", "âêžýáíúöóá¿",
"âêžýáíúöóá¿") #Here script works fine.
     issueCommandInKazBox5($node1, "add user es1fr+也是夜市 role
legaladmin".force_encoding("ASCII-8BIT"), "")
    clickLogout()
end

  def test_0002
      setupnew("WEB_ADMIN")
      skipSecurity("Continue to this website")
      kazeonLegalLogin("WEB_ADMIN", "ES1FR", "âêžýáíúöóá¿",
"âêžýáíúöóá¿") #same command as above but here i got error
      clickLogout()
end

Error appear as :

···

*******************************************************
    TestCaseNum: I18N_0001
    Description: Add AD Authentication from Webadmin, for FIGS.

      > doman - ES1FR
      > loginName - ├ó├¬┼╛├╜├í├¡├║├╢├│├í┬┐
      > loginPasswd - ├ó├¬┼╛├╜├í├¡├║├╢├│├í┬┐
      > checkDomainSelectListExist() - Found domain select box
    waitForShowingUp - Log out - 10 sec
FAILED! Page didn't contain text - Cluster Management

*******************************************************
    TestCaseNum: I18N_0005
    Description: Adding FIGS and CJK users in role admin and legaladmin

    issueCommandInKazMachine=ui-n14
    issueCommandInKazcommand=add user es1fr+Σ╣ƒµÿ»σñ£σ╕é role legaladmin
    issueCommandInKazstatus=
    issueCommandInKazuser=admin
    issueCommandInKazpasswd=kazeon
Last login: Sat Aug 20 22:25:51 2011 from gui-xpi18n.kazeon.local

Log in as 'admin' to administer the Kazeon ISS system
Log in as 'root' for system maintenance only

add user es1fr+也是夜市 role legaladmin
exit
ui-n14> add user es1fr+也是夜市 role legaladmin

            Command failed.
            Status: Failure
            Error: User: es1fr+Σ╣ƒµÿ»σñ£σ╕é already exists in Role:
legaladmin
ui-n14> exit
    --> clickLogout -
. > doman - ES1FR
failed incompatible character encodings: ASCII-8BIT and UTF-8

Can someone help me how can i have script working from the point it is
failing i.e second login routine.

Thanks
Bhavesh

--
Posted via http://www.ruby-forum.com/.