web.utils
function: safestr()
# Converts any given object to utf-8 encoded string.
function safestr(obj, encoding='utf-8')
ie.
>>> safestr(u'184')
'\xe1\x88\xb4'
字符串在Python內部的表示是 unicode 編碼 (以unicode作為中間編碼)
encode
str1.encode('big5')
decode:
str1.decode('big5')
ie.
>>> import sys
>>> print sys.getdefaultencoding()
ascii
html quote
web.urlquote(result[1])