0
在瀏覽器中顯示它在我的MySQL表我在馬拉雅拉姆語(utf8mb4_unicode_520_ci)有數據。我的REST API獲取使用的JdbcTemplate並在瀏覽器中顯示的數據。看到的內容所需的字體已經安裝在系統中。但內容仍然如下所示。如何從MySQL中獲取語言Malayalalam數據和通過Java REST API
謾Â'¡ÃÂ'²ÃÂμ�ââ,¬ï¿½ÃÂ'¹ÃÂ'¿ÃÃ'ÂÃÂ'¿ÃÂ'²ÃÂμÀ這Â'ªà ÂμÃÃÂ'¤ÃÂμ�ÃÂ'®ÃA'A°的Â'¾ÃÂ'®ÃÂ'¤ÃÂμ�ÃÂ'¤ÃÂμ�ÃÂ'®ÃÂ用於從數據庫獲取數據'¾ÃÃ'ÂÃ
代碼。
List<News> listNewsPosts = new ArrayList<News>();
query = "SELECT * FROM malayalam_dictionary";
listNewsPosts = jdbcTemplate.query(query,
new BeanPropertyRowMapper<News>(News.class));
我這是如何將數據返回到瀏覽器
@GET
@Path("/posts/)
@Produces(MediaType.APPLICATION_JSON)
public Response getAllPosts() {
Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
APIResponse apiResponse = new APIResponse();
apiResponse.setMessage("Fetched posts successfully!");
apiResponse.setResponseTime(ft.format(dNow));
try {
Map<String, Object> categories = new HashMap<String, Object>();
categories.put("newsDetail", newsOperationsController.getAllPosts());
apiResponse.setResponse(categories);
return Response.ok(apiResponse).build();
} catch (Exception e) {
logger.error(e, e);
apiResponse.setMessage("Something went wrong. please try again!");
return Response.status(500).entity(apiResponse).build();
}
}
請幫我在正確的格式返回API數據。
感謝