Wie druckst du ein Emoji in VSCODE? [Duplikat]Java

Java-Forum
Anonymous
 Wie druckst du ein Emoji in VSCODE? [Duplikat]

Post by Anonymous »

(UTF_8, obwohl ich UTF_16 ausprobiert habe. Orte, an denen ich UTF_16 verwendet habe)
Ich versuche, ein rotes Herz auszudrucken und bin so weit auf den Markt kommen.

Code: Select all

String input = "❤️"; // A red heart, what I'm HOPING will print into the terminal

System.out.println("output: " + input); // the "straight up copy and paste" method
< /code>
Ergebnis: < /p>
output: ??
Versuch 2:

Code: Select all

String input = "❤️"; // A red heart, what I'm HOPING will print into the terminal
int codePoint = input.codePointAt(0) ; // converts the red heart to a Decimal Code Point
System.out.println("codePoint: " + codePoint); // prints the code point to ensure its printing the right thing
String output2 = Character.toString(codePoint); // converts the code point to a red heart

System.out.println("output2: " + output2); // the "convert the codepoint to a string direct" method
< /code>
Ergebnis: < /p>
codePoint: 10084
output2: ?
Versuch 3:

Code: Select all

String output3 = Character.toString(10084);

System.out.println("output3: " + output3); // the "convert the codepoint to a string indirect" method
< /code>
Ergebnis: < /p>
output3: ?
Versuch 4:

Code: Select all

System.out.println("output4: " + "\u2764\uFE0F"); // the "unicode" method
< /code>
Ergebnis: < /p>
output4: ??
Versuch 5:

Code: Select all

PrintWriter printWriter = new PrintWriter(System.out,true);
char output5p1 = '\u2764';
char output5p2 = '\uFE0F';
printWriter.println("output5: " + output5p1 + output5p2); // the "printWriter + char" method
< /code>
Ergebnis: < /p>
output5: ??
Ich habe versucht, CHCP 65001 in das Terminal einzugeben (habe die Idee, dies aus diesem Beitrag zu tun) und ein anderes Ergebnis erhalten, aber immer noch nicht notwendigerweise günstig.
codePoint: 10084
output: ❤️
output2: ❤
output3: ❤
output4: ❤️
output5: ❤️
< /code>
Ergebnisse mit UTF-16 LE: < /p>
codePoint: 10084
output: ❤️
output2: ❤
output3: ❤
output4: ❤️
output5: ❤️
< /code>
Das Problem ist, dass andere Unicode -Zeichen gut funktionieren: < /p>
System.out.println("output: " + "\u00FF"); // the last char on the Latin 1 Supplement char set
System.out.println("output2: " + "\u0100"); // the first char on the extended Latin 1 char set
< /code>
Ergebnis: < /p>
output: ÿ
output2: ?
< /code>
Das erste Zeichen ist wie erwartet gedruckt, während die zweite Frage als Fragezeichen druckt. Nach allem, was ich gesehen habe, hätte mein erster Versuch genug sein sollen. Es druckte ursprünglich ein rotes Herz ohne Ausgabe. Gewissheit, dass ich jedoch bin. src = "https://i.Sstatic.net/dduk38u4.png"/>
< Eine zusätzliche Vorsichtsmaßnahme habe ich jedoch ausprobiert, was Duncg vorschlug, nämlich in den CHCP 65001 -Modus einzusteigen und ein Herz in das Terminal einzufügen. Das letzte Mal, dass ich mein Programm ausgeführt habe, und die Ausgabe war kauderisch anstelle eines roten Herzens. " src = "https://i.sstatic.net/2fi94tom.png"/>
Ich habe auch versucht, die Schriftart in segoe UI Emoji zu wechseln, da das Windows -Emoji -Schriftart ist. Dies war jedoch auch nicht erfolgreich:

Ich habe auch versucht, die letzte Ausgabe des letzten Ausgangs in der letzten Resort -Schriftart zu verwenden. src = "https://i.sstatic.net/511npm3h.png"/>
, die in einfachem Text ausgegeben werden (nur eine gerade Kopie aus dem Terminal lol):
codePoint: 10084
codePoint: 65
output2: ?
Latin A: A
< /code>
dito, aber im CHCP 65001 -Modus:

codePoint: 10084
codePoint: 65
output2: ❤
Latin A: A
< /code>
Ich habe beide Schriftarten mit allen Versionen meines Codes ausprobiert und muss noch ein rotes Herz erstellen. : (

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post