utf8 test

This commit is contained in:
Holger Trampe 2021-10-23 01:37:04 +02:00
parent e92779c881
commit 132a123676
1 changed files with 1 additions and 1 deletions

View File

@ -443,7 +443,7 @@ def NCSwitchStandardFiles(request):
standard = Standards.objects.get(pk=request.GET.get('standardid')) standard = Standards.objects.get(pk=request.GET.get('standardid'))
response_status = "OK" response_status = "OK"
for f in standard.addedfiles.all(): for f in standard.addedfiles.all():
filesearchdata = '<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:basicsearch><d:select><d:prop><oc:fileid/><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + settings.NEXTCLOUD_USER_API + '/Agenturdaten_' + str(standard.agency.pk) + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>' + (f.name.encode('utf-8', 'ignore')).decode('utf-8') + '</d:literal></d:like></d:where></d:basicsearch></d:searchrequest>' filesearchdata = '<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:basicsearch><d:select><d:prop><oc:fileid/><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + settings.NEXTCLOUD_USER_API + '/Agenturdaten_' + str(standard.agency.pk) + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>' + str(f.name).encode('UTF-8') + '</d:literal></d:like></d:where></d:basicsearch></d:searchrequest>'
r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav", data=filesearchdata, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), headers={'Content-Type' : 'text/xml'}) r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav", data=filesearchdata, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), headers={'Content-Type' : 'text/xml'})
fileid = getFileIdFromXML(r.text) fileid = getFileIdFromXML(r.text)
if(fileid == None): if(fileid == None):