Giter Club home page Giter Club logo

Comments (14)

libetl avatar libetl commented on June 15, 2024

I am having a look.

from curl.

libetl avatar libetl commented on June 15, 2024

I have written three extra unit tests to cover the encoding parsing :

    @Test
    public void theSkyIsBlueInIvritWithTheWrongEncoding() throws IOException {
        HttpResponse response = this.curl("-k -E src/test/resources/clients/libe/libe.pem https://localhost:%d/public/  -H 'Content-Type: text/plain; charset=ISO-8859-1' -d \"השמים כחולים\"");
        Assertions.assertThat(IOUtils.toString(response.getEntity().getContent(), "utf-8")).contains("'????? ??????'");
    }

    @Test
    public void theSkyIsBlueInIvritWithoutEncoding() throws IOException {
        HttpResponse response = this.curl("-k -E src/test/resources/clients/libe/libe.pem https://localhost:%d/public/  -d \"השמים כחולים\"");
        Assertions.assertThat(IOUtils.toString(response.getEntity().getContent(), "utf-8")).contains("'השמים כחולים'");
    }

    @Test
    public void theSkyIsBlueInIvritWithUTF8Encoding() throws IOException {
        HttpResponse response = this.curl("-k -E src/test/resources/clients/libe/libe.pem https://localhost:%d/public/  -H 'Content-Type: text/plain; charset=UTF-8'  -d \"השמים כחולים\"");
        Assertions.assertThat(IOUtils.toString(response.getEntity().getContent(), "utf-8")).contains("'השמים כחולים'");
    }

It can now encode a payload using the correct encoding from the Content-Type header.

from curl.

libetl avatar libetl commented on June 15, 2024

will be the content of 0.0.17

from curl.

libetl avatar libetl commented on June 15, 2024

0.0.17 is currently staging, should be shipped in a couple of hours.

from curl.

SayedSadat avatar SayedSadat commented on June 15, 2024

in version 0.0.17 still has the problem :(

from curl.

SayedSadat avatar SayedSadat commented on June 15, 2024

you can use this link for test
https://api.bot-dev.org/danestani/

from curl.

libetl avatar libetl commented on June 15, 2024

Ok, thanks, you mean read data, and not post data.

from curl.

SayedSadat avatar SayedSadat commented on June 15, 2024

Yes

from curl.

libetl avatar libetl commented on June 15, 2024

I am sorry, I am not able to reproduce that error.
image

from curl.

libetl avatar libetl commented on June 15, 2024

$("https://api.bot-dev.org/danestani/") =
curl https://api.bot-dev.org/danestani/

from curl.

SayedSadat avatar SayedSadat commented on June 15, 2024

it work for me in Intellij
but when i compile to jar file not work !
other persian chars show but when i use curl it change text to this
آیا میدانستید تمامی پستانداران به استثنای انسان و میمون کور رنگ میباشند؟

from curl.

SayedSadat avatar SayedSadat commented on June 15, 2024

and only persian chars not show
i dont have problem with English

from curl.

libetl avatar libetl commented on June 15, 2024

Ok. I will give it a try later.

from curl.

libetl avatar libetl commented on June 15, 2024

I was able to test that issue :
image

Unfortunately it does not seem to be related to the lib itself, because the problem is caused by a bad display of the text.

When opened in a text editor, I can see that :
image
The characters are not lost when saved in a new file.

Then,

  • Are there additional steps after retrieving the output ? Please check that you always read the input streams using the UTF-8 encoding, and that you always get the bytes from the string with the UTF-8 encoding too.
  • You will have to check your <meta charset="UTF-8"> if you are using the lib from a webapp,
  • or you will have to debug your android app if you are trying to display the text inside a TextInput. Is it correctly rendered from the activity / fragment (use the intelliJ debugger) ?

Sorry I don't have a clue.

from curl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.