View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
09542Bug reportsRemoteControlpublic2015-03-02 16:33
Reporterquarrier Assigned Toc_schmitz  
PrioritynormalSeveritytrivial 
Status closedResolutionnot fixable 
Product Version2.05+ 
Summary09542: add_survey method create survey with ?????? charactes in title
Description

Method add_survey (appplication/json) creating suvey with ???? (ru locale, UTF-8 encoding) title
Creating from example on https://manual.limesurvey.org/RemoteControl_2_API
With english titles work fine

Steps To Reproduce

package survey;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class Test {

public static String parse(String jsonLine) {
    JsonElement jelement = new JsonParser().parse(jsonLine);
    JsonObject jobject = jelement.getAsJsonObject();
    String result = jobject.get("result").toString();
    return result;
}

public static void main(String[] args) throws UnsupportedEncodingException {
    CloseableHttpClient client = HttpClients.createDefault();

    HttpPost post = new HttpPost(
            "http://HOSTNAME/index.php/admin/remotecontrol");
    post.setHeader("Content-type", "application/json");
    post.setEntity(new StringEntity(
            "{\"method\": \"get_session_key\", \"params\": {\"username\": \"admin\", \"password\": \"PASSWORD\" }, \"id\": 1}"));
    try {
        HttpResponse response = client.execute(post);
        System.out.println("Status = " + response.getStatusLine());
        if (response.getStatusLine().getStatusCode() == 200) {
            HttpEntity entity = response.getEntity();
            String sessionKey = parse(EntityUtils.toString(entity));

/* post.setEntity(new StringEntity(
"{\"method\": \"list_groups\", \"params\": {\"sSessionKey \": "

  • sessionKey
  • ", \"iSurveyID \": \"518347\" }, \"id\": 1}"));*/
    post.setEntity(new StringEntity(
    "{\"method\": \"add_survey\", \"params\": {\"sSessionKey \": "
  • sessionKey
  • ", \"iSurveyID \": \"100000\""
  • ", \"sSurveyTitle\": \"Проверка\""
  • ", \"sSurveyLanguage\": \"ru\""
  • ", \"sformat\": \"G\"}, \"id\": 1}"));
    response = client.execute(post);
    if (response.getStatusLine().getStatusCode() == 200) {
    entity = response.getEntity();
    System.out.println(EntityUtils.toString(entity));
    }
    }

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

    }

}

Additional Information

may be need set encoding? but i don't know where...

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)150211
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql 5.5.40-0+wheezy1
Server OS (if known)Linux survey 3.2.0-4-amd64 #1 SMP Debian 3.2.63-2+deb7u2 x86_64 GNU/Linux
Webserver software & version (if known)Apache/2.2.22 (Debian)
PHP Version5.4.35-0+deb7u2

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2015-03-02 16:33

administrator   ~31744

How is that a LimeSurvey bug? If you need support please use the forums instead, thank you.

Hint: http://stackoverflow.com/questions/15322002/how-to-send-string-by-http-post-in-utf-8

Issue History

Date Modified Username Field Change
2015-03-02 15:27 quarrier New Issue
2015-03-02 16:33 c_schmitz Note Added: 31744
2015-03-02 16:33 c_schmitz Status new => closed
2015-03-02 16:33 c_schmitz Assigned To => c_schmitz
2015-03-02 16:33 c_schmitz Resolution open => not fixable