Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Garbage text at top of page after website transfer

Posted on 2014-02-05
8
277 Views
Last Modified: 2014-02-06
I am just in the process of transferring a website, but on the new server I am getting garbage text at the top of the page. See http://46.32.231.136/~marblele/

The software used on this website is http://www.open-realty.org

Any idea why the garbage text is there and how to get rid of it?
0
Comment
Question by:petewinter
  • 3
  • 3
  • 2
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39836313
Looks like Unicode characters in one of your pages.
0
 

Author Comment

by:petewinter
ID: 39836357
Thanks, but any idea how to get rid of it?
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 100 total points
ID: 39836374
Check you top level pages i.e. open them and have a look, (and make sure they are encoded as UTF-8 without BOM as this will make sure any Unicode will show up incase they are 'hidden')
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 400 total points
ID: 39836445
Looks like invalid Unicode characters!

http://validator.w3.org/check?uri=http%3A%2F%2F46.32.231.136%2F~marblele%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

This will give you a little more guidance about character-encoding issues.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html

The fact that the pattern of junk is repeated four times might be an important clue.  How many include() steps are done before the browser output is started?  If it's four, you may find that all of your sub-scripts are spitting out a bit of junk.
0
 

Author Comment

by:petewinter
ID: 39838466
Thanks for the advice all. I have narrowed the issue down to the code below...

error_reporting(E_ALL& ~E_NOTICE);
global $lang;
$lang = array();
if ($handle = opendir(dirname(__FILE__).'/versions')) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn") {
			if (!is_dir(dirname(__FILE__).'/versions/' . $file)) {
				include(dirname(__FILE__).'/versions/' . $file);
				}
			}
		}
	closedir($handle);
	}
if ($handle = opendir(dirname(__FILE__).'/custom')) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn") {
			if (!is_dir(dirname(__FILE__).'/custom/' . $file)) {
				include(dirname(__FILE__).'/custom/' . $file);
				}
			}
		}
	closedir($handle);
	}

Open in new window


Any idea what is wrong with the above?
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 39838648
There might be nothing wrong with the above.  All it does is include() some files.  You might want to look into those /versions/ and /custom/ directories.  Open each of the files in those directories with a text editor (not Notepad) and save them in UTF-8 without Byte Order Marks.  I am not sure this will fix it, but there is a chance it might.  

Another thing to look for would be garbage in the files themselves.

You might also want to rethink this:
error_reporting(E_ALL& ~E_NOTICE);

What that line of code means to you is that if you make a typographical error somewhere in that script or in any other script included after that script, PHP will not tell you about it.  Instead PHP will silently ignore reliance on undefined variables.  This is AntiPractice #4 -- it can make debugging very, very difficult.

You might also want to ask yourself what purpose the $lang variable plays.  It appears to be injected into the symbol table, and made global (why?) but not used in the script.
0
 

Author Closing Comment

by:petewinter
ID: 39838987
Many thanks. You advice has help me find a solution
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39839084
Thanks for the points.  Best of luck with the project, ~Ray
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question