Jump to content

Problem with encoding php and jquery


Perfidus

Recommended Posts

Hi there!

I'm using the load() function from jquery  which uses ajax to load php inside a div in a document.

This document has a tag for utf-8 encoding in it's correct place, so I thought that all the contents loaded inside the document will follow the rule: I WAS WRONG.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

I have seen my problem in lot's of forums but the answers given over them don't work for me.

My php looks more or less like this:

<?Php
header ('Content-type: text/html; charset=utf-8');
if($condition = true)
{
?>
HERE GOES SOME HTML AND THIS IS WHAT I'M LOADING
<?
}
?>

As you can see, I'm also adding a header to tell the PHP that it must be utf-8 encoded, but maybe because the content is outside the <? ?> tags, it is not afecting it, so I get weird characters in the document.

How can I fix that?

 

Link to comment
https://forums.phpfreaks.com/topic/180291-problem-with-encoding-php-and-jquery/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.