I have an application. 2 EditText, one is the text input field in utf, the second is the output of the converted text in the format "\u041f\u0440\u0438\u0432\u0435\u0442" I enter: "Привет" , and in response I should receive "\u041f\u0440\u0438\u0432\u0435\u0442"
I found such code on the Internet, but it did not work for me:
String ucs = ed_utf.getText().toString(); //получаю входные данные try { byte[] utf8 = ucs.getBytes("UTF-8"); String unicodeData = new String(utf8, "UTF-8"); ed_unicode.setText(unicodeData); //передаю строку в EditText2 } catch (UnsupportedEncodingException e) { e.printStackTrace(); } The output is the same as in the input EditText.