Playing video whose title contains special characters
#1
Hi,

I am accessing the api via an self-written Android client. When I try to play a file by directly launching it via open, I have the problem that I can not play titles containing special characters (like umlaut 'ü').

Example:

{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"smb://NAS/Videos/Filme/Misc/Das fünfte Element.ts"}},"id":1}"

However when I use SoapUI to do the same thing everything works like a charm.

I assume I have to set a character encoding, but I have not idea what exactly I have to to.
Currently I use the following code:

protected String doInBackground(String... urls)
{
String response = "";
{
DefaultHttpClient client = new DefaultHttpClient();
String url = urls[0];
String jsonString = urls[1];
HttpPost httpPost = new HttpPost(url);
StringEntity se = null;
try
{
se = new StringEntity(jsonString);
se.setContentType("application/json;charset=UTF-8");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8"));

}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}

httpPost.setEntity(se);
try
{
HttpResponse httpResponse = client.execute(httpPost);
response = EntityUtils.toString(httpResponse.getEntity());
}
catch (Exception e)
{
e.printStackTrace();
}
}
return response;
}
}

As you can see, I am using UTF-8, but I have already tried without setting UTF-8 but to no avail...

Any ideas would be very welcome.


Thanx,

Rudi
Reply
#2
You are not using UTF-8 Smile

You are saying to Kodi that you will use UTF-8 but never encode the string to UTF-8 Wink
Reply
#3
Hello Tolriq,

thanks for your answer. If I understand your answer correctly you are saying that I have to encode the string itself too? That makes sense;-)

I never realsized that - thanks for opening my eyes!

Edit: Everything's working great now!

Rudi
Reply

Logout Mark Read Team Forum Stats Members Help
Playing video whose title contains special characters0