Andrei C.
Andrei C.

Reputation: 57

Problems with French encoding in Jquery

i spent 3 hours to find solutions but it's unsuccessfully. I send variable familie with "pompe à injection-injecteurs" thru AJAX POST and i'm always getting value "pompe à injection-injecteurs". I have tried to use utf8_encoding, mb_strtolower and more, more ..... but no luck.

var familie = "<?php echo $familie ?>";
console.log(familie) 
marque = $('#car_marque').find(":selected").text();
$.ajax({
  type: "POST",
  data: {familie: familie, marque: marque },
  dataType: "text",
  url: "index.php?route=product/autres/cars",
  success: function (data) {

Console.log output: "pompe à injection-injecteurs".

Upvotes: 1

Views: 162

Answers (1)

Maksim Vi.
Maksim Vi.

Reputation: 9235

Try the following:

$.ajax({
  type: "POST",
  data: {familie: familie, marque: marque },
  contentType:"application/x-www-form-urlencoded; charset=UTF-8",
  dataType: "text",
  url: "index.php?route=product/autres/cars",
  success: function (data) {

Upvotes: 1

Related Questions