4
When I recover records from a SQL Serve database with PHP errors appear in accentuation.
But in the database, the accents are correct. Is there any way to handle this with PHP? I don’t have permissions to change the collation bank.
Collation of the bank: Latin1_general_ci_as
File connection to the bank:
$host='xxxxxx';
$user='xxxxx';
$database='xxxxx';
$pass='xxxxx';
$con=mssql_connect($host, $user, $pass) or die ("Erro de conexão com o banco de dados");
mssql_select_db("$database") or die ("Erro ao selecionar banco de dados");
Fields on the bench:
Result of PHP query
Ever tried to use
escape
?– Wellington Avelino
No. How do you use it? I don’t know it
– Amanda Lima
But if the accents are correct in the bank then it is not necessary to change the collation
– Ricardo
Edit your question with the parts that are in trouble @Amandaoliveiradelima
– Wellington Avelino
What Collation and Field Type (nvarchar) ?
– gmsantos
@gmsantos, I don’t have access to the bank structure to see the field type. But the Collation is Latin1_general_ci_as
– Amanda Lima
Amanda, click [Edit] and enter the important comments in the question body (collation). Also provide how you are connecting PHP to SQL Server (it is by PDO?)
– gmsantos
@gmsantos, I edited there
– Amanda Lima
Place header('Content-Type: text/html; charset=ISO8859-1'); resolve?
– gmsantos
Aeeeee @gmsantos this worked, thank you very much!!
– Amanda Lima
@Amandaoliveiradelima converted the comment to a response. If you solved your problem, you can mark it as correct. To understand how things work around here start by doing a [tour]
– gmsantos