Send message Telegram VietNamese UTF8 FAIL with spring boot java

Viewed 14

public void sendMessage(String message, String chatID) throws Exception { try { RestTemplate restTemplate = new RestTemplate(); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiUrl + "/sendMessage") .queryParam("chat_id", chatID).queryParam("text", message); ResponseEntity exchange = restTemplate.exchange(builder.toUriString().replaceAll("%20", " "), HttpMethod.GET, null, String.class); } catch (HttpClientErrorException | HttpServerErrorException e) { String mess1 = String.format("Error response : State code: %s, response: %s ", e.getStatusCode(), e.getResponseBodyAsString()); logger.error(mess1); throw e; } catch (Exception err) { String mess1 = String.format("Error: {} ", err.getMessage()); logger.error(mess1); throw new Exception("This service is not available at the moment!"); } } IF message = "Thịt chó chấm mắm tôm === ". Bot telegram will show error message have not decode Please help me send UTF8 telegram bot with my function. Thanks

0 Answers
Related