Skip to content

Commit e356eff

Browse files
committed
Use UTF-8 encoding for metadata pipe (#177)
1 parent 2577329 commit e356eff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • core/src/main/java/xyz/gianlu/librespot/player

core/src/main/java/xyz/gianlu/librespot/player/Player.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import xyz.gianlu.librespot.player.contexts.AbsSpotifyContext;
2626

2727
import java.io.*;
28+
import java.nio.charset.StandardCharsets;
2829
import java.util.ArrayList;
2930
import java.util.Base64;
3031
import java.util.List;
@@ -742,9 +743,9 @@ private void send(@NotNull String type, @NotNull String code, @Nullable String p
742743

743744
if (payload != null) {
744745
out.write(String.format("<item><type>%s</type><code>%s</code><length>%d</length>\n<data encoding=\"base64\">\n%s</data></item>", type, code,
745-
payload.length(), Base64.getEncoder().encodeToString(payload.getBytes())).getBytes());
746+
payload.length(), Base64.getEncoder().encodeToString(payload.getBytes(StandardCharsets.UTF_8))).getBytes(StandardCharsets.UTF_8));
746747
} else {
747-
out.write(String.format("<item><type>%s</type><code>%s</code><length>0</length></item>", type, code).getBytes());
748+
out.write(String.format("<item><type>%s</type><code>%s</code><length>0</length></item>", type, code).getBytes(StandardCharsets.UTF_8));
748749
}
749750
}
750751

0 commit comments

Comments
 (0)