Only one script write wrong charset

I can´t unserstand what is wrong

all site are running with utf-8 and i not have problem with charset

Only during one script

$query=“select from table where id=”
$result_query=mysqli_query($conn, $query);
$sql= “insert into table …”
if (mysqli_num_rows ($result_query)>0){

echo " Já existe" // it means record already exist

}

this Já php writes as J�

but if only write in any div of site <?php echo "Já"?> it writes the word correctly,

Is your form processing code, that doesn’t echo the output correctly, above the start of the html document? If so, any output from your form processing code should be stored in php variable(s), then echoed at the appropriate point in the html document.

Try adding either:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

or

<meta charset="iso-8859-1">

In your header area above the
Might help…

changing iso not work.

the code is

echo "<div class=“row” style=“border:5px solid#070707; background-color: aliceblue>”;
}if(mysqli_num_rows($resultado1) >0){
echo "

Já existe

" ;
}
echo “”

html page source

<div class=“row” style=“border:5px solid#070707; background-color: aliceblue”> <p> J� existe o recibo, ramo, apolice = </p>

Everything I have read for you say it is a problem with UTF-8 issues. usually the ISO version fixes some of them. You can try:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
which is used on some servers.

Hope that one works…

But, I also read that it might be your editor. I had this same problem a very long time ago and fixed it by using a different editor. Editor’s save the file in different formats and sometimes that confuses the server.
In that case, you just need to edit the page in a different editor like, believe it or not, notepad.exe or notepad++ and save them as a UTF-8 format. Then reload back to your server and test that way.
PS: I hate these problems, took me two weeks to fix one on a simple icon display once. Same as this issue!

1 Like

I believe in editor.

Because this script was original written in notepad++

let me try create one new file on Dreamweaver,

Thank You @ErnieAlex

100 points!!!

I just copy and paste the code in DreamWeaver and it works.

And this stupid bug make me lost more than 1 hour!!!

Great! I had a similar issue and it was so annoying!

Glad it helps! See you in the bitstream… (That’s all this is…)

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service