diff options
| -rw-r--r-- | h-client/hlibrary.py | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 1a86d81..c763a76 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -22,6 +22,7 @@ import re  import sys  import pycurl  import urllib +import htmlentitydefs  from xml.dom import minidom @@ -80,9 +81,14 @@ class Device(object):  		self._post['comm_year'] = self._year;  		self._post['pci_id'] = self._vendorId + ':' + self._productId;  		self._post['interface'] = self._interface; -		self._post['description'] = self._description; +		self._post['description'] = self.htmlentitiesDecode(self._description.replace("\n","\r\n"));  		self._post['driver'] = self._driver; +	#replace the HTML entitites with utf-8 characters +	def htmlentitiesDecode(self,string): +		for entity,code in htmlentitydefs.name2codepoint.iteritems(): +			string = string.replace("&"+entity+";",unichr(code)) +		return string.encode('utf-8')  	#get the distro h-source allowed code from the distro codename  	def getDistroCode(self,codenameString): | 
