1

I am struggled with this problem.

Let me resume whats going on.

I want to replicate the submit of a form hosted on a external site. But when I get the response, I get question marks "?" where there is supose to be characters with accents.

Let me be more explicit.

1) Check the site (I did not build it):

Its in spanish, but let me guide you.

You can see a form , in the combo box, select "Asunto", and in the "N°" textbox, insert "1234/2016" and then click "Consultar" button.

after that you can see the result, and you can perfectly see the "accent characters" like á é , etc.

.... Now ... I am trying to replicate that from my software.

I replicate the submit using Jquery/Ajax call, and I did it, I can get the results and everything, ... BUT, the accent characters are shown as "?" question marks like (from chrome dev tools):

The javascript code used to make the call is ..

var ajaxCall4 = $.ajax({
        url: '<*the url provided at the beggining*>', 
        type:'POST',
        data:{ 
            expediente_numero: _valores.expediente_numero, 
            expediente_codigo: _valores.expediente_codigo,
            expediente_ano: _valores.expediente_ano, 
            documentacion_tipo_id: _valores.documentacion_tipo_id,
            documentacion_id: _valores.documentacion_id ,
            B1:'Consultar' 
        },
        timeout: 5000
    });

I am totally lost on this, I tried setting the contentType explicitly, but doesnt work, I need your help.

Checkout and example execution from the Advanced REST client Extension in chrome..

IN ADITION.

*I the HTML file that displays the results I have the

*The results obtained from the ajax request, are "append" to a "table" tag adding new rows.

  • Now please check if you have in head of document where you display it :) – Marko Mackic Jul 21 '16 at 22:10
  • Hi @MarkoMackic , and yes ... I have the tag in the head section of the HTML file displaying the results. I will edit the question to provide more details –  Jul 21 '16 at 22:42
  • Try "ISO-8859-2" as charset. That contains acute accent characters, like á, é – Bálint Jul 21 '16 at 23:23
  • now I want you to see in your ajax response ( which is probably html page) do you have tag, if you're embedding html in html it's not proper syntax and it may confuse the browser, ajax transfers data and I don't think it scrambles with encoding – Marko Mackic Jul 21 '16 at 23:48
  • Once I receive the response, I parse it, extracting only the text I want. I save that text on a string variable, and then add that string in a table row. –  Jul 21 '16 at 23:54
  • Can someone "replicate" the same form behavior as the original site but using ajax ? or another technique ? That website doesnt have a webservice I can use, so ... I have to "emulate" it. –  Jul 21 '16 at 23:55
  • Possible duplicate of [Convert ISO-8859-1 to UTF-8](http://stackoverflow.com/questions/22587308/convert-iso-8859-1-to-utf-8) –  Jul 25 '16 at 14:48

1 Answers1

2

When displaying a page that contains strange characters you have to specify encoding in head section like this :

<meta charset="utf-8">
Marko Mackic
  • 2,293
  • 1
  • 10
  • 19
  • Yes I have that, but doesnt work, I already editted the question providing more details. *I the HTML file that displays the results I have the *The results obtained from the ajax request, I "append" to a "table" tag adding new rows. –  Jul 21 '16 at 22:45
  • @fachamix the script you provided logs FALLO, which means your script is not good, please correct it so we could see the example you see – Marko Mackic Jul 21 '16 at 22:52
  • Yes, thats why I remarked to run it under a browser without security policies. or you can run the call using a chrome extension like Advanced REST client. I will do it and will upload the screen captures in order to ilustrate better this. –  Jul 21 '16 at 23:10
  • yes my friend, because the important part is how i make the ajax call, nobody was going to be able to run the code snippet because it needs to be run under a non secure browser. –  Jul 21 '16 at 23:43