0

I am trying to fetch a CSV file from a website (https://www.stocknet.fr/accueil.asp) using a GET request on the https URL. The response I get via Postman looks like this:

Type;Groupe Acc�s;Code;EOTP autoris�s;Familles EOTP autoris�es;Nom;Pr�nom;Adresse Mail;Agences autoris�es;D�p�ts autoris�s;Date cr�ation;Fournisseurs autoris�s;Classes autoris�es;Familles article

But when access the URL directly, my browser automatically downloads the file, and I open it on windows with a proper encoding:

Type;Groupe Accès;Code;EOTP autorisés;Familles EOTP autorisées;Nom;Prénom;Adresse Mail;Agences autorisées;Dépôts autorisés;Date création;Fournisseurs autorisés;Classes autorisées;Familles article

When I inspect the website HTML, I can see the tag <meta charset="ISO-8859-1" />

I tried using headers as such:

Accept-Charset: ISO-8859-1
Accept-Charset: UTF-8
Content-Type: text/csv; charset=ISO-8859-1
Content-Type: text/csv; charset=UTF-8
Content-Encoding: gzip
Content-Encoding: compress
Content-Encoding: deflate
Content-Encoding: identity
Content-Encoding: br

Nothing seem to return a response with the correct encoding.

Any idea what I am doing wrong ? Note that, whatever page of the website I try to fetch, I get this wrong encoding. It's not only with the CSV file.

1 Answer 1

1

The server is returning content in iso-8859-1 and telling you it's iso-8859-1. You will not convince the server to return anything else. Your web browser contains code to convert encodings. If you want to have the content in a different encoding, you have to convert it yourself.

For ways how to do that, see: Best way to convert text files between character sets?

Sign up to request clarification or add additional context in comments.

3 Comments

I see I got it all wrong ! Thanks. I'm trying to convert it using PL/SQL, and I can't seem to make it work though. Trying something like convert(l_response, 'WE8ISO8859P1', 'WE8MSWIN1252') .. You have any idea ?
@Kabulan0lak I don't know PL/SQL and have no way to try it, sorry. Looks like that could be a new question. Why 1252 as dest though? I don't think that can express an è. Didn't you want UTF8?
It corresponds to the NLS parameter of my Oracle instance. Thanks you for everything! I'm going to try out more stuff then post another question if really needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.