How to save a file in gb2312 encoding

I using Watir to show a webpage’s text, but the out put is like

irb>>

\242\204\346\265\213\351\243\216\

I want output same as the character show in the webpage, how can i do.

( i searched before asking, and using iconv but no success, maybe I am
in a incorrect way)

require “watir”
require ‘iconv’
url=“http://www.163.com

ie = Watir::IE.new
ie.goto url
c=ie.table(:index,10).text

=> “\303\277\310\325\323\242\323\357\321\307\324\313\271\331\315
5\300\r\n\312\326\273\372\315\370\322\327\315\370\323\320\265\300
6\264\312\265\344”

conv = Iconv.new(“utf-8”,“gb2312”)
result = conv.iconv©

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs