Android Question [Solved] Web Service REST and accents (invalid characters) in JSON

Discussion in 'Android Questions' started by asales, Jan 6, 2018.

  1. asales

    asales Well-Known Member Licensed User

    I have this text file in attached with this names (UTF8):
    Lúcio Fábio, Sistemas e Soluções, Maria José, Antônio José
    This file is read by a server app that returns JSON to consume in a WebService Rest in my App.

    If connect to a web server using the Chrome browser in my phone, the return is OK (with accents in names):
    but If I using my app to connect, I get the invalid characteres in names:

    I'm using this example:
    and OkHttpUtils2 2.61 library.

    I tried with Download, Download2, Job.GetString, Job.GetString2("UTF8") and StringUtils.DecodeUrl(Job.GetString, "UTF8"), but I don't get the names correctly.

    How can I fix this problem?

    Thanks in advance for any tip.

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    The server response is not encoded in UTF8.

    What is the output of:
    asales likes this.
  3. asales

    asales Well-Known Member Licensed User

    Thanks! This was it. The encode is ISO-8859-1.

    Now I use this code to send a map encode with ISO-8859-1, instead PostString, that uses UTF-8 by default:
    j.PostBytes("", objJSon.ToString.GetBytes("ISO-8859-1"))
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice