From: "Bartosz Dziewoński" Date: 2011-08-17T04:07:44+09:00 Subject: Re: How to send utf8 data to remote computer in ruby 1.9.2 2011/8/16 Bhavesh Sharma : > Hi Brian, > > Thanks for your inputs. > > I tried the way you mentioned : > > issueCommandInKazBox($node1, "add user âêžýáíúöóá¿ role > admin".force_encoding("ASCII-8BIT"), "") > > And it worked :) > > I still surprise why it is not working when i use utg8 instead of > ascii-8bit Just for future reference: "ASCII-8BIT" encoding is the same as "BINARY" encoding. Therefore setting encoding to "ASCII-8BIT" is equivalent to "erasing" encoding information, and many libraries who depend on "byte" having the same meaning as "character" (ie., anything that uses string[n] notation on binary data...) just may accidentally work right. If you ever get encoding-related errors, common sense doesn't seem to work, and you don't really care about the data that blows up, just force_encoding('binary') on everything :) -- Matma Rex