Good day!
I'm trying to configure api Yandex. Translator inside the application on android. When transferring words in Latin, everything works well, but as soon as I try to translate from Russian into any other language, question marks instead of translation come in response. Translates English to Russian normally.
link = "https://translate.yandex.net/api/v1.5/tr.json/translate?key=" + myKey + "&text=" + word + "&lang=" + baslang + "-" + learnlang; If word is a Cyrillic string, everything is displayed normally in the debug window, but it comes to the server at https://translate.yandex.net/api/v1.5/tr.json/translate?key=trnsl.1.1.20150902T132259Z .448e3d1d80a9ea8e.5584e6a80be79d826cde897c5204d6eacbfae45e & text = ???? & lang = ru-en , that is, instead of the text question marks, respectively, Yandex sends such a "word" untranslated - ????
code itself:
@Override protected String doInBackground(Void... params) { // получаем данные с внешнего ресурса try { URL url = new URL(link); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); StringBuffer buffer = new StringBuffer(); reader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = reader.readLine()) != null) { buffer.append(line); } resultJson = buffer.toString(); } catch (Exception e) { e.printStackTrace(); } return resultJson; } How to make the word remain in Cyrillic?
wordvariable contains valid data? - Vartlok 2:21 pm