将utf8解码为big5

时间:2016-06-20 07:51:35

标签: python utf-8 big5

每一个,我都试图通过python发送短信,我可以发送它,但我需要发送中文,这是big5,我必须解码utf8到big5,这是我的短信python代码

  

trydecode.py

import urllib
import urllib2


def sendsms(phonenumber,textcontent):
    textcontent.decode('utf8').encode('big5')
    url = "https://url?username=myname&password=mypassword&dstaddr="+phonenumber+"&smbody="+textcontent
    req = urllib2.Request(url)
    response = urllib2.urlopen(req)

这段代码(python2.7)我可以用英文发短信但是中文(big5)有问题,我该怎么办呢?谢谢

1 个答案:

答案 0 :(得分:3)

我认为您忘记保存它以更改变量。

require 'nokogumbo' doc = Nokogiri::HTML5.get(uri)

相关问题