# Mechanize output:strange number

require ‘mechanize’
agent = WWW::Mechanize.new
page =
agent.get(‘http://hd.openv.com/tv_play-hddoc_20090703_7064487.html’)

i get the following output:

“\347\210\261\345\215\241\346\261\275\350\275\246”
http://newcar.xcar.com.cn/”>
“58\347\224\237\346\264\273\345\234\210”
http://q.58.com/”>
“\345\207\244\345\207\260\345\233\275\346\227\205”
http://www.51tour.com/”>
“\351\236\255\347\211\233\345\243\253”
http://www.bianews.com/”>
“\345\244\232\347\216\251\346\270\270\346\210\217\347\275\221”
http://www.duowan.com/”>
“\344\271\220\351\200\224\346\227\205\346\270\270\347\275\221”

what is the meanning of
“\347\210\261\345\215\241\346\261\275\350\275\246”?

On Jun 10, 2010, at 17:55 , Pen T. wrote:

http://newcar.xcar.com.cn/”>
“\345\244\232\347\216\251\346\270\270\346\210\217\347\275\221”
http://www.duowan.com/”>
“\344\271\220\351\200\224\346\227\205\346\270\270\347\275\221”

what is the meanning of
“\347\210\261\345\215\241\346\261\275\350\275\246”?

With `curl -I \$url` you can quickly see that the page is encoded UTF-8.
If you take off the “-I” you can see the content. In my terminal, it
displays very prettily:

``````  <div class="img"><a href="tv_show-8210.html" target="_hdplay"><img alt="Discoveryå…¨çƒé¦–é€‰ç»¿ä½å®¶" title="Discoveryå…¨çƒé¦–é€‰ç»¿ä½å®¶"  src="http://swf1.openv.tv/programme/dvdprogramme/20100511/20100511_movieplay_upload_105856370_small.jpg" width="151" height="113" /></a></div>
``````

You’re probably running your script with the default ASCII encoding. Try
this out:

my system:ubuntu10.04+firefox
shell terminal :utf-8
how to set my irb terminal with the default ASCII encoding?

irb(main):001:0> \$KCODE = “U”
=> “U”
when i add \$KCODE = “U”,the output is ok.
i input in shell :irb,need input \$KCODE = “U” everytime?
can i set it?when i open irb , the code is U?

On Jun 11, 2010, at 03:57 , Pen T. wrote:

my system:ubuntu10.04+firefox
shell terminal :utf-8
how to set my irb terminal with the default ASCII encoding?

I’m kinda surprised that `irb` doesn’t have a -K flag… so read up on
\$KCODE.

Good Afternoon,

On Fri, Jun 11, 2010 at 5:59 PM, Pen T. [email protected] wrote:

## irb(main):001:0> \$KCODE = “U” => “U” when i add \$KCODE = “U”,the output is ok. i input in shell :irb,need input \$KCODE = “U” everytime? can i set it?when i open irb , the code is U?

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

You need a .irbrc file which will run automatically for you when you
start
IRB. You should just be able to put your \$KCODE= ‘U’ inside a .irbrc
(note