How to send utf8 data to remote computer in ruby 1.9.2

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 :slight_smile:

I still surprise why it is not working when i use utg8 instead of
ascii-8bit
i.e.

issueCommandInKazBox($node1, "add user âêžýáíúöóá¿ role
admin".force_encoding("UTF-8"), "")

Thanks for your input again.

Bhavesh

···

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

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 :slight_smile:

-- Matma Rex

···

2011/8/16 Bhavesh Sharma <bhavesh1_sharma@rediffmail.com>:

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 :slight_smile:

I still surprise why it is not working when i use utg8 instead of
ascii-8bit