473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

utf-8 pages and php 4.1.1

Hi,

I'm running into a problem with php 4.1.1 on IIS (XP Pro version).
For example writing a page test.php that starts with

<?php session_start(); ?>
<?php echo '<?xml version="1.0"'; ?>
<?php echo ' encoding="utf-8" ?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"><!-- InstanceBegin template="/Templates/stdPage.dwt"
codeOutsideHTMLIsLocked="true" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
....

and saving the test.php in UTF-8 format in UltraEdit-32 or SciTE,
then running the page, there's a complaint for session_start() about
headers/page data having already been sent. If the same page is
saved as "plain" ASCII, it works. Any ideas how to get an UTF-8
encoded page to work in php 4.1.1, without upgrading?

thanks,
- Jan
Aug 22 '05 #1
7 2107
JDS
On Mon, 22 Aug 2005 15:35:48 +0300, Jan Wagner wrote:
I'm running into a problem with php 4.1.1 on IIS (XP Pro version).


Upgrade immediately!! Upgrade PHP, that is. Not for functionality
reasons; for security reasons. You have been warned.

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Aug 22 '05 #2
JDS wrote:
On Mon, 22 Aug 2005 15:35:48 +0300, Jan Wagner wrote:
I'm running into a problem with php 4.1.1 on IIS (XP Pro version).


Upgrade immediately!! Upgrade PHP, that is. Not for functionality
reasons; for security reasons. You have been warned.


Unfortunately I'm not the admin, and upgrading to PHP 5.0.3 for
Novell might break some of the hosted sites. I'd have liked
Tomcat/JSP instead of a vulnerability ridden PHP interpreter anyway,
but Tomcat 4/5 won't run on NW5.

However, my devel machine I now upgraded 5.0.4, to check. Oddly I
still get the same session warnings for UTF-8 files:

Warning: session_start() [function.session-start]: Cannot send
session cookie - headers already sent by (output started at
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php:1) in
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php on line 1

Warning: session_start() [function.session-start]: Cannot send
session cache limiter - headers already sent (output started at
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php:1) in
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php on line 1

and the line 1 is <?php session_start(); ?>

When I convert the php to 8-bit ascii the warnings disappear.
Probably not a bug but a wrong setting somewhere? Or, other way
round, is anyone using UTF-8 encoded .php files and it is working
fine for them? Required changing something in php.ini?

- Jan
Aug 22 '05 #3
JDS
On Mon, 22 Aug 2005 19:16:48 +0300, Jan Wagner wrote:
Unfortunately I'm not the admin, and upgrading to PHP 5.0.3 for
Novell might break some of the hosted sites. I'd have liked
Tomcat/JSP instead of a vulnerability ridden PHP interpreter anyway,
but Tomcat 4/5 won't run on NW5.


I didn't say upgrade to PHP5. Update to PHP 4.4. That should prevent
most breakages and improve security.

Unfortunately, I really don't have an answer regarding your UTF problems.
Sorry.

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Aug 22 '05 #4
On Mon, 22 Aug 2005 15:35:48 +0300, Jan Wagner <no*****@thanks.net> wrote:
I'm running into a problem with php 4.1.1 on IIS (XP Pro version).
For example writing a page test.php that starts with

<?php session_start(); ?>

and saving the test.php in UTF-8 format in UltraEdit-32 or SciTE,
then running the page, there's a complaint for session_start() about
headers/page data having already been sent. If the same page is
saved as "plain" ASCII, it works. Any ideas how to get an UTF-8
encoded page to work in php 4.1.1, without upgrading?


Odds are you have a UTF-8 BOM (Byte Order Marker) at the start of the script.

In Ultraedit:

Advanced, Configuration, General tab,
Scroll to "Load/Save Conversions"
Disable the two "Write UTF-8 BOM" options.

http://bugs.php.net/bug.php?id=22108 appears to indicate that UTF-8 encoded
PHP scripts with a leading BOM is basically not supported, for reasonable
reasons (it can't tell if it's a BOM to ignore, a BOM that should be sent, or
actually some binary data that happens to look like a BOM).

Since you can always save it without a BOM that's not too bad.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Aug 22 '05 #5
>However, my devel machine I now upgraded 5.0.4, to check. Oddly I
still get the same session warnings for UTF-8 files:

Warning: session_start() [function.session-start]: Cannot send
session cookie - headers already sent by (output started at
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php:1) in
c:\Inetpub\wwwroot\spraknat\Kultur-GDolivo-text.php on line 1
You may not output *ANYTHING* before the headers. Not
a blank line. Not a single space. Not a UTF-8 marker
that says it's UTF-8.
and the line 1 is <?php session_start(); ?>


And what's before the <? on line 1? Dump your file in hex
to be sure.

Gordon L. Burditt
Aug 22 '05 #6
JDS wrote:
On Mon, 22 Aug 2005 19:16:48 +0300, Jan Wagner wrote:
Unfortunately I'm not the admin, and upgrading to PHP 5.0.3 for
Novell might break some of the hosted sites. I'd have liked
Tomcat/JSP instead of a vulnerability ridden PHP interpreter anyway,
but Tomcat 4/5 won't run on NW5.
I didn't say upgrade to PHP5. Update to PHP 4.4. That should prevent
most breakages and improve security.


Ok thanks! I'll suggest it to the admin (although the newest php4
for netware is 4.2.3 and not 4.4.0, but I suppose that's still
better than 4.1.1 :)
Unfortunately, I really don't have an answer regarding your UTF problems.
Sorry.


Found it myself after more digging... Bug #22108,
http://bugs.php.net/bug.php?id=22108, solution included in php 5 cvs
but not enabled per default in the win32 release. "This will come
with Unicode support in PHP 6.0". So looks like until then, no
unicode support in win32 (unless you recompile php5), and all code
and pages must remain "plain" ASCII. Apparently same thing for
netware. Well well...

thanks,
- Jan
Aug 22 '05 #7

(I did not refresh and see this before my prev posting...)

Andy Hassall wrote:
On Mon, 22 Aug 2005 15:35:48 +0300, Jan Wagner <no*****@thanks.net> wrote:
Odds are you have a UTF-8 BOM (Byte Order Marker) at the start of the script.

In Ultraedit:

Advanced, Configuration, General tab,
Scroll to "Load/Save Conversions"
Disable the two "Write UTF-8 BOM" options.


Yes, that works! Good workaround - thanks! :)

- Jan
Aug 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
Someone on www.php.net suggested using a seems_utf8() method to test text for UTF-8 character encoding but didn't specify how to write such a method. Can anyone suggest a test that might work?...
4
by: Alban Hertroys | last post by:
Another python/psycopg question, for which the solution is probably quite simple; I just don't know where to look. I have a query that inserts data originating from an utf-8 encoded XML file....
12
by: Mike Dee | last post by:
A very very basic UTF-8 question that's driving me nuts: If I have this in the beginning of my Python script in Linux: #!/usr/bin/env python # -*- coding: UTF-8 -*- should I - or should I...
38
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I...
6
by: jmgonet | last post by:
Hello everybody, I'm having troubles loading a Xml string encoded in UTF-8. If I try this code: ------------------------------ XmlDocument doc=new XmlDocument(); String s="<?xml...
6
by: archana | last post by:
Hi all, can someone tell me difference between unicode and utf 8 or utf 18 and which one is supporting more character set. whic i should use to support character ucs-2. I want to use ucs-2...
7
by: Jimmy Shaw | last post by:
Hi everybody, Is there any SIMPLE way to convert from UTF-16 to UTF-32? I may be mixed up, but is it possible that all UTF-16 "code points" that are 16 bits long appear just the same in UTF-32,...
1
by: sheldon.regular | last post by:
I am new to unicode so please bear with my stupidity. I am doing the following in a Python IDE called Wing with Python 23. äöü äöü '\xc3\xa4\xc3\xb6\xc3\xbc' u'\xe4\xf6\xfc'...
10
by: Jed | last post by:
I have a form that needs to handle international characters withing the UTF-8 character set. I have tried all the recommended strategies for getting utf-8 characters from form input to email...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.