Skip to content

UTF8 characters - Latin Diacritics are not rendering properly  #63

Description

@nithyasharabheshwara

Hi,

I checked the output of the REST API call from the browser, it is showing Latin Diacritics properly, however, the string returned from com.afrozaar.wordpress.wpapi.v2.model.Post.getContent().getRendered() contains an invalid string with the special characters appearing as ?.
It should be an easy fix for the author, I believe somewhere the conversion is not happening properly. I will try to fix it and submit a PR but please do check.

Update
I was able to fix this. You need to slightly edit the file

com.afrozaar.wordpress.wpapi.v2.Client.java:127
Before

        restTemplate = new RestTemplate(messageConverters);

After

import java.nio.charset.StandardCharsets;
....
        restTemplate = new RestTemplate(messageConverters);
        restTemplate.getMessageConverters()
            .add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));

It is a very simple change, I have never submitted a PR actually, may be the authors can fix this on their own. If a PR is required let me know, I will submit one. For now, this solves my problem.

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions