Situation: I am trying to display Japanese characters in my PHP site. I set up a test case where I first do a session_start(), then echo out some Japanese characters. I save the file as UTF-8.
The code looks like:
<?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
echo "Home:ホーム<br>";
?>
</body>
</html>
When bringing up this page I get the error:
Warning: Cannot send session cookie - headers already sent by (output started at /var/www/html/fbx_SettingsUTF8.php:5) in /var/www/html/fbx_SettingsUTF8.php on line 6
Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/html/fbx_SettingsUTF8.php:5) in /var/www/html/fbx_SettingsUTF8.php on line 6
When I save the file as ANSI I do not get the error, but then the Japanese characters do not display correctly.
Does anybody know a resolution for this? The session_start() is causing the problem?
Thanks
Dennis
dennis_e_browne aatt hotmail ddott com
session_start() and UTF-8 characters error
Moderator: General Moderators
-
dennisbrowne
- Forum Newbie
- Posts: 2
- Joined: Mon Jun 16, 2003 1:39 pm
This issue is similar to:
viewtopic.php?t=1157
Ensure you are not outputting any thing including whitespace before session_start();, usually outside your <?php ?> declaration.
Regards,
viewtopic.php?t=1157
Ensure you are not outputting any thing including whitespace before session_start();, usually outside your <?php ?> declaration.
Regards,
-
dennisbrowne
- Forum Newbie
- Posts: 2
- Joined: Mon Jun 16, 2003 1:39 pm
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
There are no blank lines before the <?php but there is the BOM mark.
http://www.unicode.org/unicode/faq/utf_bom.html#22
Microsoft tools, most prominently Windows Notepad, prefix the BOM to Unicode text files regularly. Upon saving a Unicode text file in Notepad, the BOM is always prefixed.
<?php
You should remove them.
UltraEdit-32 is able to display the BOM.
http://www.unicode.org/unicode/faq/utf_bom.html#22
Microsoft tools, most prominently Windows Notepad, prefix the BOM to Unicode text files regularly. Upon saving a Unicode text file in Notepad, the BOM is always prefixed.
<?php
You should remove them.
UltraEdit-32 is able to display the BOM.