简体   繁体   English

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

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

So i want to use RSS FEED with android studio on a greek site.I used this code and everything works good but the greek letters on the site are not recognised.Any help?所以我想在希腊网站上使用带有 android 工作室的 RSS FEED。我使用了这个代码,一切正常,但网站上的希腊字母无法识别。有帮助吗? this is my output这是我的 output

I think you can try okhttp instead of apache .我认为您可以尝试okhttp而不是apache

build.gradle build.gradle

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

ResponseInterceptor.java响应拦截器.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;
    }
}

Using使用

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

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

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