SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Strange  characters appearing in XHTML PHP pages

    Why do these characters appear in my PHP pages:

    

    Sometimes they appear near <?php, yet they don't appear every time <?php is on the page. They usually appear once to a page, but I've seen them next to each other twice in a row on a single page. The characters are not in the original PHP code, but magically appear in the source code.

    Puzzled,
    Steve H

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have your text editor save the files as either ansi, or if you want utf8, then choose no byte order mark(BOM).

  3. #3
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Changing it from

    charset=iso-8859-1

    to

    charset=utf-8

    has made a slight difference - different characters are showing up (vertical boxes). After a bit of research, I can't figure out how to indicate no BOM. Can you clarify?

    Thanks!
    Steve H

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Take Notepad++ for example.

    The editor shows the type of file (ANSI, UTF-8, etc) at the bottom right of the window.

    The Format menu allows you to encode the file or convert it as ANSI, UTF-8, UTF-8 without BOM, and other types too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Using the encode without BOM works great! Thank you, guys!

    Regards,
    Steve H

  6. #6
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oops, a bit premature. Still shows strange characters when PHP is used. Shows a vertical box, like a page, but small.

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    How might we experience this problem too, so that we can come up with a solution for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pmw57 View Post
    How might we experience this problem too, so that we can come up with a solution for you.
    Go to this page in your iPhone or iPod touch:
    www.rc10.com/mobile

    Click on Team Associated
    Click on New Products

    You'll see the figures at top.

    Thanks!
    Steve H

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    I don't know if this is related, but between the <body> and the google script, there are some strange characters appearing.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #10
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pmw57 View Post
    I don't know if this is related, but between the <body> and the google script, there are some strange characters appearing.
    Yet the strange characters are not in the original documents!

  11. #11
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    They will be there. The web page doesn't just create them out of thin air.
    It's just that your editor is not currently capable of seeing them.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #12
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If I highlight the characters off the screen and copy them, then open the PHP documents, including the "include" documents, and do a search, they don't appear. Maybe if I squeeze a bit of lemon juice over them, maybe the words will magically appear! LOL

    Here's a portion of the google script. Could these characters inadvertently form the strange characters?

    type='text/javascript'&#37;3E%3C/script%3E"

    Thanks!
    Steve H

  13. #13
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    Here's a portion of the google script. Could these characters inadvertently form the strange characters?

    type='text/javascript'%3E%3C/script%3E"
    No, they won't be responsible.

    Do you want do put up a cut-down version of the parts involved, and upload them to box.net - then we can look at the actual files including their character encoding and advise you on how best to resolve this.

    If you can also let is know the editor that you are using, we can also advise you on how to control it (if possible) to prevent further occurrences.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  14. #14
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I am using iWebKit 4.6.2 for the Javascript functions that make it function like an iPhone.

    I used to make the pages in Microsoft Expression web. Now I'm using Notepad++.

    I'll look into Box.net Monday and see what I can do.

    Thanks!
    Steve H

  15. #15
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Okay, the file is in Box.net:

    [deleted]

    Of course, the file, database, and field names have been changed for protection. Post #8 shows navigation to the page.

    Thanks!

  16. #16
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    It's happening right at the place where the include.php file is being included.
    Aside from the fact that you really should be using require_once instead of include, I would look at the include.php file as the cause of the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  17. #17
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Strange ... It's the common connection script with server, username, and password.

    Also has an include script for a Google analytics page which includes Javascript. But none of those characters are on either page.

  18. #18
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by StevenHu View Post
    Strange ... It's the common connection script with server, username, and password.

    Also has an include script for a Google analytics page which includes Javascript. But none of those characters are on either page.
    They will be there - if you wish to, add those two files (with sensitive parts removed) to box.net and I'll investigate for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  19. #19
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'll have to stop here. I don't think the company will approve.

    Thanks for your help, though!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •