繁体   English   中英

如何使用 android 工作室对 RSS 提要上的希腊字母进行编码

[英]How to encode Greek letters on RSS feed using android studio

所以我想在希腊网站上使用带有 android 工作室的 RSS FEED。我使用了这个代码,一切正常,但网站上的希腊字母无法识别。有帮助吗? 这是我的 output

我认为您可以尝试okhttp而不是apache

build.gradle

dependencies {
    ...
    implementation "com.squareup.okhttp3:okhttp:4.2.1"
}

响应拦截器.java

public class ResponseInterceptor implements Interceptor {
    @NotNull
    @Override
    public Response intercept(@NotNull Chain chain) throws IOException {
        Response response = chain.proceed(chain.request());
        Response modifiedResponse =
                response.networkResponse().newBuilder()
                        .addHeader("Content-Type", "application/json; charset=utf-8")
                        .build();
        return modifiedResponse;
    }
}

使用

OkHttpClient client = new OkHttpClient.Builder()
            .......
            .addInterceptor(new ResponseInterceptor())
            .build();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM