My CodeIgniter app has started to a freak error:
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
In the first visit, the page appears fine, just a message "guimbu" . If you refresh the page, the error appears until you clear the history of browser. This happens only after second page-view. Take a look: http://guimbu.com/soon
My autoload.php has this:
$autoload['packages'] = array();
$autoload['libraries'] = array('session', 'database', 'firephp', 'auth');
$autoload['helper'] = array('url', 'log_helper', 'api_helper', 'string_helper');
$autoload['config'] = array('ci_opauth', 'rest', 'ci_auth');
$autoload['language'] = array();
$autoload['model'] = array();
How can I debug this problem?
UPDATE:
@sudhir, thanks for the answer, but I tried this many times. Actually the source code is just:
<!DOCTYPE html>
<head>
<title>guimbu</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
guimbu =)
</body>
</html>
And the error persists after second page-view =/ Maybe a problem with sessions?
UPDATE with possibility:
When I remove session and auth libraries from autoload , the problem doesn't happen. WTF? auth is a library I made for user authentication.
When you refresh that page you get a blank one, if you view source that page you'll see it's blank that is has a number count. My guess is that you're doing something when the page refreshes that sends a white space to the browser. I can only suggest not to close your files with ?>
and let php handle how your scripts will exit/die. There's some whitespace in your code that's causing that.
try adding these in head section of your view:
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
FOUND SOLUTION
In the first lines of Session class constructor, it loads the String helper. Yesterday I've created a helper called string_helper.php and this conflict was what crashing application.
I renamed my string_helper.php file and now everything works fine.
Thanks all!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.