+++++++++++++++++++ python-HTMLEntity +++++++++++++++++++
HTML Entities for Python
For install python-HTMLEntity, run on terminal: ::
$ git clone git@github.com:wangjingbupt/python-HTMLEntity.git
$ cd python-HTMLEntity
$ [sudo] python setup.py install
Normal encode ::
import HTMLEntity
HTMLEntity.encode('<') # returns '<'
Deal with Chinese or other Special character, please use unicode string ::
import HTMLEntity
t = '测试'.decode('utf-8') # '测试'.decode('gbk')
HTMLEntity.encode(t) # returns '测试'
import HTMLEntity
HTMLEntity.decode('<') # returns '<'
HTMLEntity.decode('测试') # returns '测试'
HTMLEntity.decode('实体字符') # returns '实体字符'
This work is base on https://github.com/cobrateam/python-htmlentities
contact: wangjingbupt@gmail.com