Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Unable to store copyright symbol in Redis cache and Postgres DB through Java JPA

$
0
0

I have a scenario where I am reading a JSON file which contains a text(Copyright © 2022) that contains copyright symbol. I am reading this file from AWS S3 and storing in StringBuilder for processing. Now it works fine till the reading is done.The issue comes in persistence it shows '??' in the DB for copyright character.So when the data is fetched from DB it again shows '??' . In Redis it looks like \xef\xbf\xbd\xef\xbf\xbdNeed a Solution as in how will I save the Data correctly in DB and in Redis Cache. Or I will have to do some processing while fetching the data .Dev tool : IntelliJJDK : OPENJDK 11postgresqlVersion=42.3.6redisSchemaVersion=1.1.0-SNAPSHOT

Below is the code snippet of POC for reading it from AWS S3.

InputStream inp;S3ObjectInputStream sis;sb = new StringBuilder() ;S3Object so =  s3.getObject(new GetObjectRequest(bucketName, folderURL+"/"+ fileName));inp = so.getObjectContent();sc = new Scanner(inp);while (sc.hasNext()) {                System.out.println(sc.nextLine());                sb.append(sc.nextLine());            }....pojo.addMetadata(sb.toString());repo.save(pojo);

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>