Skip to content

UTF8 characters - Latin Diacritics are not rendering properly  #63

@nithyasharabheshwara

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions