mirror of https://gitlab.com/bashrc2/epicyon
csv encoding
parent
ef606161a1
commit
35a1a3ecc9
|
@ -10800,8 +10800,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix,
|
||||
self.server.domainFull,
|
||||
self.path)
|
||||
msg = json.dumps(catalogStr,
|
||||
ensure_ascii=False).encode('utf-8')
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/csv',
|
||||
msglen, None, callingDomain)
|
||||
|
|
|
@ -963,7 +963,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
|||
return ''
|
||||
csvStr = \
|
||||
'id,type,hasType,startDate,expiryDate,' + \
|
||||
'quantity,price,currency,Image,description,\r\n'
|
||||
'quantity,price,currency,Image,description,\n'
|
||||
for item in catalogJson['DFC:supplies']:
|
||||
csvStr += '"' + item['@id'] + '",'
|
||||
csvStr += '"' + item['@type'] + '",'
|
||||
|
@ -975,7 +975,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
|||
csvStr += '"' + item['DFC:price'].split(' ')[1] + '",'
|
||||
csvStr += '"' + item['DFC:Image'] + '",'
|
||||
description = item['DFC:description'].replace('"', "'")
|
||||
csvStr += '"' + description + '",\r\n'
|
||||
csvStr += '"' + description + '",\n'
|
||||
return csvStr
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue