CURL doesn't encode UTF-8 CURL doesn't encode UTF-8 curl curl

CURL doesn't encode UTF-8


After a discussion with @Dekel and a suggestion coming from @Phylogenesis I could resolve the problem partially, but effectively. There are 2 ways:

  • charset=ISO-8859-1
  • encoding a file and sending as binary-data

The server could receive the correct letter using charset=ISO-8859-1. Even the response data from server showing incorrectly.

I use: curl -i -X POST -H "Content-Type: text/plain; charset=ISO-8859-1" --data-ascii "name=AdministraĆ§Ć£o" http://localhost:8084/ws/departments

The second way is encoding a file containing all the content you want to POST. I used Notepad++ > Format > Convert to UTF-8 (Without BOM).

Then, prompt: curl -i -X POST -H "Content-Type: text/plain; charset=UTF-8" --data-binary "@test.txt" http://localhost:8084/ws/departments.