Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/chinese encoding #10

Merged
merged 5 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.hc.core5.http.io.entity.StringEntity;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class DefaultExtraImageService implements ExtraImage {

Expand Down Expand Up @@ -51,7 +52,7 @@ HttpEntity buildExtraImageRequestEntity(ExtraImageOptions options) {
try {
String payload = this.beanContainer.getBean(ObjectMapper.class)
.writeValueAsString(options);
return new StringEntity(payload);
return new StringEntity(payload,StandardCharsets.UTF_8);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.hc.core5.http.io.entity.StringEntity;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class DefaultImage2ImageService implements Image2Image {

Expand All @@ -40,7 +41,7 @@ public Image2ImageResult img2img(Image2ImageOptions options) {
ClassicHttpRequest buildRequest(Image2ImageOptions options) {
String url = container.getBean(SdWebuiOptions.class).getEndpoint() + IMG2IMG_PATH;
ClassicHttpRequest request = new HttpPost(url);
request.setEntity(new StringEntity(JsonUtils.toJson(options)));
request.setEntity(new StringEntity(JsonUtils.toJson(options), StandardCharsets.UTF_8));
request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.apache.hc.core5.http.io.entity.StringEntity;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class DefaultTxt2ImageService implements Txt2Image {

Expand Down Expand Up @@ -52,7 +53,7 @@ HttpEntity buildTxt2ImageRequestEntity(Txt2ImageOptions options) {
try {
String payload = this.beanContainer.getBean(ObjectMapper.class)
.writeValueAsString(options);
return new StringEntity(payload);
return new StringEntity(payload,StandardCharsets.UTF_8);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
Expand Down
Loading