-2

I am currently working on a Discord bot that provides stats about a game. My problem is that I can't find a way to convert for example

"Cyb |\\u00e2\\u00ad\\u0095\\u00e2\\u0083\\u00a4 LostCube" 

to a proper name with the Unicode included.

The current output:
the current output

I tried a bunch of stuff and don't have any idea how to go on. If any of you might a an idea or a solution, please let me know.

Output I'm expecting:
The output I'm expecting

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Gork
  • 7
  • 1
  • See [this Answer](https://stackoverflow.com/a/3537745/642706) using *Apache Commons Lang*. – Basil Bourque Mar 06 '23 at 21:00
  • Please open [Help] and read at least [ask]. Then, [edit] your question to share a [mcve]. Questions that only ask for code are too broad and are likely to be [put on hold or closed](https://stackoverflow.com/help/closed-questions). You face a [mojibake](https://en.wikipedia.org/wiki/Mojibake) case (*example in Python for its universal intelligibility*): `"Cyb |\u00e2\u00ad\u0095\u00e2\u0083\u00a4 LostCube".encode('latin1').decode('utf-8')` returns `'Cyb |⭕⃤ LostCube'`. – JosefZ Mar 06 '23 at 21:21
  • You are expected to perform some research effort before asking a question here. Since you have _"tried a bunch of stuff"_ update your question to detail what you have tried so far. Otherwise your question may be closed. – skomisa Mar 06 '23 at 22:32

1 Answers1

0

Java strings use UTF-16 encoding, so you need to use that. You used UTF-8 instead. Encoded in UTF-16, this would be the string you would end up with:

"Cyb |\u2b55\u20e4 LostCube"
Minn
  • 5,688
  • 2
  • 15
  • 42