Solved

Garbage text at top of page after website transfer

Posted on 2014-02-05
8
278 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
[X]
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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

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 110

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 110

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

740 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