如何在Andoid应用程序中显示波斯或阿拉伯字母wordpress帖子?

时间:2019-05-03 18:11:15

标签: java android localization

我有一个波斯语wordpress网站,现在我想以JSON格式获取其数据并显示在android应用程序中,我该如何使用波斯语呢?

  

SITE_URL / wp-json / wp / v2 / posts /

  

SITE_URL / wp-json / wp / v2 / posts /?page = 1

我已经使用了这2种方法,但是它们都不起作用,并且应用程序中的新闻部分为空,但显示类别!

public interface ApiService {
          String BaseURL= "https://irantopbet.net/";

          /*category() used for fetch main category list*/
          @GET("wp-json/wp/v2/categories?per_page=100")
          Call<JsonElement> category();

          /*getFeatureNews() used for featuresnews list*/
          @GET("wp-json/wp/v2/posts")
          Call<JsonElement> getFeatureNews();

          /*contactus used for add contact details */
          @FormUrlEncoded
          @POST("api/contact_us.php")
          Call<JsonElement> contactus(@Field("name") String name, @Field("email") String email, @Field("message") String message);

          /*getNewsByCatID used for fetch news using category id*/
          @GET("wp-json/wp/v2/posts?")
          Call<JsonElement> getNewsByCatID(@Query("categories") String catID);

          /*search used for search all project content*/
          @GET("wp-json/wp/v2/posts/?")
          Call<JsonElement> search(@Query("search") String world);

          /*getNewsByNewsID used for get news detais*/
          @GET("wp-json/wp/v2/posts/{NewsId}")
          Call<JsonElement> getNewsByNewsID(@Path("NewsId") String newsID);

          /*getAllComment used for view all comments*/
          @GET("wp-json/wp/v2/comments")
          Call<JsonElement> getAllComment(@Query("post") String postId);

          /*addComment used for add comment in news details*/
          @FormUrlEncoded
          @POST("api/comment.php")
          Call<JsonElement> addComment(@Field("post_id") String postId,
                                       @Field("comment_author") String commentAuthor,
                                       @Field("comment_author_email") String commentAuthorEmail,
                                       @Field("comment_content") String commentContent,
                                       @Field("user_id") String userId);

          /*getAllLatestNews used for all latest news list*/
          @GET("wp-json/wp/v2/posts?")
          Call<JsonElement> getAllLatestNews(@Query("categories") String 
          catID,@Query("page") int per_page);
}

https://irantopbet.net/wp-json/wp/v2/categories?per_page=100 这是应用程序上显示的作品和类别

但是 https://irantopbet.net/wp-json/wp/v2/posts 当打开此链接时,上面有东西,但应用程序上没有任何显示

1 个答案:

答案 0 :(得分:0)

似乎您已经从服务器接收到unicode字符。这意味着您必须将那些unicode字符转换为波斯字符。请遵循以下答案:How to conver unicode into text