Php jquery autocomplete不能很好地处理重音
我在jquery的自动完成中遇到了一些重读问题。 当我用重音输入字母时,结果是“MÁ;THEUS”而不是“MÁTHEUS” 我试着把utf8编码改为解码,然后我得到了“M?THEUS” 按照我的代码吼叫 retronar_cliente_processo.php htmlPhp jquery autocomplete不能很好地处理重音,php,jquery,mysql,autocomplete,Php,Jquery,Mysql,Autocomplete,我在jquery的自动完成中遇到了一些重读问题。 当我用重音输入字母时,结果是“MÁ;THEUS”而不是“MÁTHEUS” 我试着把utf8编码改为解码,然后我得到了“M?THEUS” 按照我的代码吼叫 retronar_cliente_processo.php html 客户名称 在这里,删除htmlentities(),这就是为什么会得到MÁ;美国而不是美国MÁTHEUS: $row['value']=stripslashes(utf8_encode($row['
客户名称
在这里,删除htmlentities(),这就是为什么会得到MÁ;美国
而不是美国MÁTHEUS:
$row['value']=stripslashes(utf8_encode($row['value']));
您是否看过/考虑过本例中描述的重音折叠?我认为最终结果更令人满意。否则,了解编码问题发生的位置会有所帮助。是在回发到服务器时还是在查询数据库时?
utf8\u encode()
,ISO-8859-1/拉丁语-1到UTF-8。你确定编码是拉丁文1吗?哇..非常感谢。经过多次尝试,此解决方案已圆满解决(很高兴能帮助您!)
$(document).ready(function() {
$('#clientes').autocomplete({
source: 'php/retornar_cliente_processo.php',
minLength: 1,
select: function(event, ui) {
$('#clienteId').val(ui.item.id);
$('.form-control').removeAttr("disabled");
$('#clientes').attr("disabled", "disabled");
$('#alteraNome').removeAttr("disabled");
},
}); }
<input type="hidden" name="clienteId" id="clienteId" placeholder="ID">
<div class="form-group">
<div class="col-md-12">
<label for="clienteNome" class="control-label">Nome do cliente</label>
<div class="input-group">
<input type="text" autocomplete="off" name="clienteNome" id="clientes" class="form-control" placeholder="Nome do cliente" required>
</div>
</div>
</div>
$row['value']=stripslashes(utf8_encode($row['value']));