Problem with accent and special characters leave autocomplete in boldface

1

I have this script that does a search using Jquery autocomplete.

$( function($) {
    $.ui.autocomplete.prototype._renderItem = function (ul, item) {        
        var t = String(item.value).replace(
        new RegExp(this.term, "gi"),
        "<strong>$&</strong>");
        return $("<li></li>")
        .data("item.autocomplete", item)
        .append("<a>" + t + "</a>")
        .appendTo(ul);
    };              
    
    $( "#p" ).autocomplete({
        source: "php/search_palavras.php?id_cidade=<?php echo $id_cidade; ?>",
        minLength: 2,
                        
        select: function( event, ui ) {
            // Set autocomplete element to display the label
            this.value = ui.item.label;
                    
            // Store value in hidden field
            $('#hidden_p').val(ui.item.id);

            // Prevent default behaviour
            return false;                   
        }
    });
                
    $( "#p" ).click(function() {
        $('#hidden_p').val(0);
        $('#p').val('');
    });         
}); 

Nearly everything is perfect. The only problem I'm having, I do not know if it's PHP or Jquery, but if I start a search with "aco", come the answers:

Butchers

S aco Hortifrutigrangeiros

Tourist Information Centers

Wholesale and Manufacture of S plastic s

I have tried every way, but I can not stress the "steel" or "steel" that are with cedilla and accents. Would it be possible to highlight these items as well?

    
asked by anonymous 28.06.2017 / 13:59

1 answer

0

I'm not sure if this is what you want, but I have a solution. Use the htmlspecialchars() function in the output of the data.

    
28.06.2017 / 16:45