I'm trying to get data with Latin characters in it which is like ('ş','ç','ğ','ı','İ','Ü') but instead what i'm getting as output is 'Ä�' for 'ğ', 'ç' for 'ç' Whatever i try the output is weird.
CASE WHEN type = 'a' THEN 'ğ ç ş'
ELSE 'null' END AS description
The part of sql that i'm having trouble with is like as seen above. The problem is in that sql part when i logged my endpoint value of description looks weird from the very beginning.
Repository class which returns query values is like below.
public LPModel findLPInfo(String id) {
LPModel list = jdbcTemplate
.queryForObject(QueryConstants.GET_PL_INFO, new Object[]{id}, new LMapper());
return list;
}
My hibernate properties is below. I added charset details to fix my problem but that didn't work.
spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:databaseName?useUnicode=true&characterEncoding=UTF-8&charSet=UTF-8
@PostMapping(value = "/getid", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<PostResponse> getid(@RequestBody LWRequest postRequest {
PostResponse response= new PostResponse();
LPModel lpm = listRepository.findLPInfo(postRequest.id);
String desc = String.valueOf(new String(lpm.DESCRIPTION.getBytes(), "UTF-8").getBytes("ISO-8859-1"));
log.info("Description " + lpm.DESCRIPTION +" "+ desc);// desc and lpm.DESCRIPTION returns like '�'
response.setDESC(lpm.DESCRIPTION);
return response;
}
End point is working and i added produces = MediaType.APPLICATION_JSON_UTF8_VALUE part just to be sure that response is in UTF-8 type and with desc i tried to encode to utf-8 but that didn't worked either. i'm only showing relevant parts of my code about my problem.
i need to show output with exact characters like ğ ç ş