歌词文件字符编码

main
JH 10 months ago
parent 3aa830fc78
commit 8b1eef8ff9

@ -31,6 +31,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -546,7 +547,7 @@ public class CMSSongService {
connection.setRequestMethod("GET");
// 获取输入流并读取文件内容到 StringBuilder
StringBuilder contentBuilder = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
contentBuilder.append(line).append("\n");

@ -15,6 +15,7 @@ import util.IdWorker;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@Service
@ -127,7 +128,7 @@ public class S3Service {
.bucket(bucket)
.key(key)
.build();
RequestBody requestBody = RequestBody.fromBytes(content.getBytes());
RequestBody requestBody = RequestBody.fromBytes(content.getBytes(StandardCharsets.UTF_8));
PutObjectResponse putObjectResponse = s3Client.putObject(putObjectRequest, requestBody);
SdkHttpResponse sdkHttpResponse = putObjectResponse.sdkHttpResponse();
if (!sdkHttpResponse.isSuccessful()) {

Loading…
Cancel
Save