Help with PHP and MSSql special characters

1

I'm making a form, and when I write the information with special characters, it records good ... only that when I retrieve the information it comes encoded ... I've already used it, utf8_encode / decode and nothing I do not know if it's in php or in the bank that I have to move ... detail, I have no autonomy to move directly with the bank MSSql ...

A brief example:

JOHN PATIENCE

When I use: $NOME = utf8_encode($row['NOME']); - > It brings the following: "JO? THE PATIENCE"

When I use: $NOME = utf8_decode($row['NOME']); - > It brings the following: "JO? THE PACI? NCIA"

When I use: $NOME = ['NOME']; - > It brings the following: "JO? THE PATIENCE"

I do not know if it's with DB or programming that I move ... Thank you in advance!

    
asked by anonymous 04.02.2015 / 21:27

4 answers

1

In your database, the collation has to be set to utf8_geneal_ci or something related, in your php you have to format for utf8 without good and in the database connection you have to instruct the cogitation of set nane utf8 or something related in mssql and at the time of inserting or reading the information you can not encode or decode or it will generate conflict

    
05.02.2015 / 10:53
0

In addition to the text formatting, what page formatting are you using? You have to see the formation of the page and which charset is defined in the HTML. A charset conflict and HTML formatting can generate these types of errors.

I hope I have helped.

    
04.02.2015 / 22:34
0

What collation are you using in the bank?

When you add the information in the database you are decoding them? Ex: $novoNome = utf8_decode($_POST['nome']);

    
05.02.2015 / 04:49
-3

Before the SQL statement puts the following expression:

mysql_query("set names 'utf8'");
    
04.02.2015 / 22:40