Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Garbage text at top of page after website transfer

Posted on 2014-02-05
8
Medium Priority
?
283 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 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1600 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 111

Accepted Solution

by:
Ray Paseur earned 1600 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 111

Expert Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

782 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