0

I am dumping MySQL database into a JSON file. This database contains this symbol "–" everywhere and I want to use that in my Java code cause I need the exact String.

What is there that I can do to use that symbol?

Note that when I dump the db I get a ? mark symbol where – is and I just have sth like a Gradle job to edit but this solution didn't really work.

MistaGoustan
  • 346
  • 6
  • 21
  • 1
    Not particularly clear what you're asking. Typically a question mark character instead of your desired symbol might indicate an encoding issue. – Mena Apr 17 '19 at 15:15
  • Yes, I figured so. Tried changing the encoding too though that wouldn't resolve anything. So I have been playing around with different types of encoding like UTF-16, 8, etc. though I still can't use it. Any pointers on where I can check which encoding this belongs to? – Harris Mavrokefalidis Apr 17 '19 at 15:18
  • Your mysql schema will have a character set associated, e.g. maybe "latin1" in your case. so hopefully you don't need to guess it. Not sure how you dump the db contents in the JSON file, but chances are it's interpreted as unicode by your Java code, hence the issues. – Mena Apr 17 '19 at 15:24
  • Please edit your question and show is the code you’re using to do this dump, including the JDBC URL you’re using. (Obviously we don’t want to see your actual password though.) – VGR Apr 17 '19 at 15:26
  • So, first I'd take a look [here](https://stackoverflow.com/questions/1049728/how-do-i-see-what-character-set-a-mysql-database-table-column-is) to see what you got. Then I'd look into whatever you're using to dump to JSON and make sure the JSON file itself is clean or uses escapes etc. Then finally look at the java side. – Mena Apr 17 '19 at 15:27
  • @VGR not sure why the JDBC URL would help, assuming there's even one here, which I doubt. – Mena Apr 17 '19 at 15:28
  • Because a JDBC URL can specify a character encoding as one of the connection properties. – VGR Apr 17 '19 at 15:34

0 Answers0