45 lines
1.6 KiB
Plaintext
45 lines
1.6 KiB
Plaintext
--- a/inc/upnp/contentdirectory.h
|
|
+++ b/inc/upnp/contentdirectory.h
|
|
@@ -39,6 +39,7 @@ public:
|
|
virtual void setError(Upnp_Action_Request* Request, int Error);
|
|
private:
|
|
cMediaDatabase* mMediaDatabase;
|
|
+ cCharSetConv* mconv;
|
|
void Action();
|
|
int getSearchCapabilities(Upnp_Action_Request* Request);
|
|
int getSortCapabilities(Upnp_Action_Request* Request);
|
|
--- a/upnp/contentdirectory.cpp
|
|
+++ b/upnp/contentdirectory.cpp
|
|
@@ -14,9 +14,13 @@
|
|
cContentDirectory::cContentDirectory(UpnpDevice_Handle DeviceHandle, cMediaDatabase* MediaDatabase)
|
|
: cUpnpService(DeviceHandle) {
|
|
this->mMediaDatabase = MediaDatabase;
|
|
+ this->mconv = new cCharSetConv((cCharSetConv::SystemCharacterTable() ?
|
|
+ cCharSetConv::SystemCharacterTable() : "UTF-8"), "UTF-8");
|
|
}
|
|
|
|
-cContentDirectory::~cContentDirectory() {}
|
|
+cContentDirectory::~cContentDirectory() {
|
|
+ delete this->mconv;
|
|
+}
|
|
|
|
int cContentDirectory::subscribe(Upnp_Subscription_Request* Request){
|
|
IXML_Document* PropertySet = NULL;
|
|
@@ -149,8 +153,15 @@ int cContentDirectory::browse(Upnp_Actio
|
|
return Request->ErrCode;
|
|
}
|
|
|
|
+ const char *utf8Result = this->mconv->Convert(ResultSet->mResult);
|
|
+ if(!utf8Result){
|
|
+ ERROR("Converting XML data failed");
|
|
+ this->setError(Request, UPNP_SOAP_E_ACTION_FAILED);
|
|
+ return Request->ErrCode;
|
|
+ }
|
|
+
|
|
char* escapedResult = NULL;
|
|
- escapeXMLCharacters(ResultSet->mResult, &escapedResult);
|
|
+ escapeXMLCharacters(utf8Result, &escapedResult);
|
|
|
|
if(!escapedResult){
|
|
ERROR("Escaping XML data failed");
|