Hi I'm trying to get special characters like ëéäá to show up in my autocomplete. For example the letter ë shows up as & # 2 3 5 ; (without the spaces).
I'm creating a php array which I json_encode. I can create the json with both ë (html_entity_decode) and & # 2 3 5 ; (without the spaces) in the object. When I create the json object with ë it doesn't show up in the autocomplete.
My autocomplete function looks as follow:
<script>
$(document).ready(function() {
$(function() {
<?php echo "var availableCustomers = " . $this->searchCustomer . ";
"; ?>
$( "#customerAutocomplete" ).autocomplete({
delay: 0,
source: availableCustomers,
select: function(event, ui) {
window.location.href = '/customer/look-customer/deb/' + ui.item.deb;
}
});
});
});
</script>
Autocomplete
allow you to manage the render of your element. You may start from this point and try to make a custom render function. You just have to specify a render function in the configuration like :
$( "#customerAutocomplete" ).autocomplete({
...
_renderItem: function( ul, item ) {
return $("<li>")
.attr("data-value", item.value)
.append($("<a>").html(item.label))
.appendTo(ul);
},
...
});
You can console.debug
the item to check if it contains your text with accent.