Skip to content

Commit

Permalink
Java 强制指定流式输出的编码为 UTF8 (#886)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiichi-Origami authored Dec 24, 2024
1 parent 3d2667e commit d01fc59
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.baidubce</groupId>
<artifactId>qianfan</artifactId>
<version>0.1.2</version>
<version>0.1.3</version>
<packaging>jar</packaging>

<name>qianfan</name>
Expand Down
2 changes: 1 addition & 1 deletion java/src/main/java/com/baidubce/qianfan/QianfanClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.Map;

class QianfanClient {
private static final String SDK_VERSION = "0.1.2";
private static final String SDK_VERSION = "0.1.3";
private static final String CONSOLE_URL_NO_ACTION_TEMPLATE = "%s%s";
private static final String CONSOLE_URL_ACTION_TEMPLATE = "%s%s?Action=%s";
private static final String QIANFAN_URL_TEMPLATE = "%s/rpc/2.0/ai_custom/v1/wenxinworkshop%s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.baidubce.qianfan.util.http;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.NoSuchElementException;

Expand All @@ -26,7 +27,7 @@ public class SSEIterator implements Iterator<String>, Closeable {
private String nextLine = null;

public SSEIterator(InputStream stream, AutoCloseable closeable) {
this.reader = new BufferedReader(new InputStreamReader(stream));
this.reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
this.closeable = closeable;
}

Expand Down

0 comments on commit d01fc59

Please sign in to comment.