I am trying to figure out how to display 🔴 in java. I am able to convert unicode to show so if I could convert 🔴to unicode then I would be set. I was thinking I could just make a big check list but figure that would cause alot of strain to check.
I am trying to show 🔴, but the API call gives me 🔴. My question is, how do I change 🔴 to the red circle other then finding the Unicode string for it.
This is what the symbol looks like 🔴
Code to format json
private static String getStringFromInputStream(InputStream is) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
String line;
try {
br = new BufferedReader(new InputStreamReader(is));
while ((line = br.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return sb.toString();
}
It looks like you're looking at the characters with an editor in which you haven't specified the correct character encoding / set.
To use smybol that String in Java, try:
String text = "\uD83D\uDD34";
JLabel label = new JLabel(text);
Source of the unicode escapes: https://www.htmlsymbols.xyz/unicode/U+1F534
(It may still be that your font doesn't have the character, in which case it will probably look like a question mark - better than 4 strange accented characters, probably)
There still remains one problem: new InputStreamReader(is)
uses the default encoding the program runs on. I would expect the fixed encoding of the is
: new InputStreamReader(is, "UTF-8")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.