Forum Moderators: coopster

Message Too Old, No Replies

PHP producing strange characters, ""...?

Anyone seen anything like this?

         

hiker_jjw

12:45 am on Feb 25, 2005 (gmt 0)



I've got a couple strange characters showing up at the top of a few of my PHP pages, but I'm not sure what's causing them. Have anyone seen something like this?



It's being outputed before any of my HTML. I've got all kinds of library/class files loaded, session management and a load of setup vars/constants. I can't seem to figure out what is causing it.

Thanks in Advance.
Jeff

StupidScript

2:30 am on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's your operating environment like?

I've seen similar gobbledygook when I was using a Windows development environment and a Unix server and forgot to specify ASCII mode for FTP transfers of text (php) files.

If it's a 'nix server and you can telnet/ssh into the server and use vi or pico to view the offending files, check for those characters, or odd line endings, like with extra spaces at the end. In a table structured web page, anything not included in a table cell (within the table) is output before the table is displayed (as you probably know), so maybe you've got a few extra binary characters that hitched a ride, like the \r\n line endings Windows uses instead of the \n line ending that 'nix uses..

ergophobe

5:01 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it's just those three chars and not a screen of similar, it's most likely the BOM (byte order mark) from a Unicode encoding.

Try setting your character encoding on the page to utf-8 and see what happens.

hiker_jjw

11:30 pm on Feb 25, 2005 (gmt 0)



I don't think it's the Server, Apache/MySQL/Plesk/etc. It's only with the PHP pages (.php), not the HTML pages (parsed as PHP pages, .html). It's strange. Probably the encoding.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Yada Yada Yada</title>
<meta name="Description" content="Yada Yada Yada" />
<meta name="Keywords" content="Yada Yada Yada" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

So, maybe it's the wrong character encoding.
Thanks guys, I'll look into that...after I get back from the beach this weekend. AHHHhhhhh...

Cheers,
Jeff

ergophobe

1:56 am on Feb 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yup, that's 99% definite the Unicode BOM that's doing that. That's almost always the character sequence you get.