Cannot Remove BOM |
Cannot Remove BOM |
William Grimsley |
May 30 2017, 12:49 PM
Post
#1
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Hello everyone,
This is my first post here! Looks like a great forum! I've got a slight problem with one of my web pages: http://newton-poppleford-weather.co.uk/data.htm. There is, for some reason, a BOM visible just above the buttons as is donated by the '""' on the right of the image I've put below. When one of the buttons is pressed, the BOM dissapears! But, upon page reload it reappears. I've tried to save the basic.php file which is implemented in that page without BOM, but it's still there. Any ideas? Thanks, William This post has been edited by William Grimsley: May 30 2017, 12:51 PM |
Christian J |
May 30 2017, 02:28 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
Hi and thanks!
I've tried to save the basic.php file which is implemented in that page without BOM, but it's still there. A text editor would insert a BOM at the beginning of basic.php, but your BOM seems to be in the middle of the page source (according to the screenshot --I don't see it in Firefox' web inspector). Maybe it's a stray character that needs to be removed manually somehow, otherwise check for a PHP-included file with a BOM at that position in the HTML source. BTW the extra spacing is there even if javascript is disabled (but disappears when enabling javascript and clicking a button), so I don't think the jQuery/Ajax is to blame for it. |
pandy |
May 30 2017, 02:36 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
It isn't a BOM. The character seems to be called a zero-width no-break space.
http://www.codetable.net/decimal/65279 I don't know how it got there. Did you maybe copy code from somewhere where it already existed? Why can't you just delete it? |
pandy |
May 30 2017, 02:47 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I didn't see there was more. What the heck does "" == $0 mean?
|
William Grimsley |
May 30 2017, 02:53 PM
Post
#5
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Thanks for the replies! No idea, I didn't copy the only thing I can remember is that I accidentally opened up the text editor in Word. Could that be it? I can't remove it because I can't see it anywhere!
I've attached the file the basic.php file includes. For some reason, I can't directly include the attached PHP file in the web page. This post has been edited by William Grimsley: May 30 2017, 03:04 PM Attached File(s) betel_readDayfile.php ( 71.53k ) Number of downloads: 158 |
Christian J |
May 30 2017, 03:14 PM
Post
#6
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
It isn't a BOM. The character seems to be called a zero-width no-break space. http://www.codetable.net/decimal/65279 https://en.wikipedia.org/wiki/Byte_order_mark#Usage says: QUOTE If the BOM character appears in the middle of a data stream, Unicode says it should be interpreted as a "zero-width non-breaking space" ...so I assumed it's the same character as a BOM, but in the wrong location. |
Christian J |
May 30 2017, 03:20 PM
Post
#7
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
the only thing I can remember is that I accidentally opened up the text editor in Word. Could that be it? No idea, but seems possible. QUOTE I've attached the file the basic.php file includes. Have you tried resaving that file as UTF-8 without BOM? QUOTE For some reason, I can't directly include the attached PHP file in the web page. Didn't understand that. |
William Grimsley |
May 30 2017, 03:53 PM
Post
#8
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
I tried opening it up in Word again, but couldn't. Yeah, I have.
|
pandy |
May 30 2017, 03:55 PM
Post
#9
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
That screen shot, is that from Chrome? Nothing I have shows it like that. Iron (Chrome clone) comes closest. It shows two quotes with some kind of whitespace between them. The rest shows nothing (don't have Chrome). Just curious.
Another thing I notice is that the document in your screen shot isn't identical with the one on the web. Viewing source I see a BODY tag without any attributes. In the screen shot there are two. Just a long shot, but what if you open the document in an editor that isn't unicode enabled and save it again? Check that spot for any funky characters first. Or use your usual editor but save the document as ANSI. Again, check for funky characters and delete them if they are there. |
William Grimsley |
May 30 2017, 04:05 PM
Post
#10
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Yes, it's from Chrome. I've been editing the page this evening. That is odd. LOL. What editor do you recommend?
This post has been edited by William Grimsley: May 30 2017, 04:05 PM |
pandy |
May 30 2017, 11:15 PM
Post
#11
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Notepad would do. Anything. If you just save as ANSI. I may be wrong about this, but it's easily done so it's worth a try.
|
William Grimsley |
May 31 2017, 02:32 AM
Post
#12
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Hmm, saved as ANSI, reuploaded and nothing changed, then reverted back, still nothing. Just to confirm, am I supposed to be looking into and saving the basic.php file or the betel_readDayfile.php?
This post has been edited by William Grimsley: May 31 2017, 02:35 AM |
William Grimsley |
May 31 2017, 02:42 AM
Post
#13
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Aha! Getting somewhere! Now it's permanently there even after clicking any of the buttons!
|
pandy |
May 31 2017, 04:16 AM
Post
#14
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I'm lost. Where does betel_readDayfile.php come into it? Is it included in basic.php?
Of course, we don't know if the bit with the character is in clear text in the PHP document of if it is generated by PHP. |
Christian J |
May 31 2017, 08:06 AM
Post
#15
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
Notepad would do. Anything. If you just save as ANSI. Yes, but only if you save as ANSI. From what I read Notepad always adds a BOM if you save as UTF-8. @William Grimsley: to save as UTF-8 without BOM you might use Notepad++ (or probably any other better text editor). |
Christian J |
May 31 2017, 08:14 AM
Post
#16
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
Just to confirm, am I supposed to be looking into and saving the basic.php file or the betel_readDayfile.php? Try saving betel_readDayfile.php (as ANSI, or as UTF-8 without BOM in a text editor that allows that). This is assuming that betel_readDayfile.php contains a BOM. Then when that file is included by PHP into basic.php, the BOM ends up as a zero-width character in the middle of basic.php. |
William Grimsley |
May 31 2017, 12:29 PM
Post
#17
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Ok, I've converted both the betel_readDayfile.php and basic.php files to ANSI. The BOM is still there, but goes away after clicking a button like originally... I'm very confused. LOL.
This post has been edited by William Grimsley: May 31 2017, 01:15 PM |
William Grimsley |
May 31 2017, 03:05 PM
Post
#18
|
Novice Group: Members Posts: 26 Joined: 30-May 17 From: Newton Poppleford, Devon, UK Member No.: 26,424 |
Ok, if I change the file to UTF-8 with BOM, the BOM is permanently there, without BOM and it disappears after clicking a button. Don't know if that helps?
|
Christian J |
May 31 2017, 03:22 PM
Post
#19
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
Ok, I've converted both the betel_readDayfile.php and basic.php files to ANSI. The BOM is still there, but goes away after clicking a button like originally... Now I loaded http://newton-poppleford-weather.co.uk/betel_readDayfile.php directly and viewed its source, and my text editor still says it's "UTF-8 (BOM)"... I also tried appending the same querystring to the URL as when you click a button: http://newton-poppleford-weather.co.uk/bet...e=0&lang=en and it's still UTF-8 (BOM). This hopefully means that the BOM doesn't come from the database, which might have complicated things. I don't know why the BOM goes away when you click the buttons, maybe the javascript strips it away somehow. |
Christian J |
May 31 2017, 03:30 PM
Post
#20
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
Ok, if I change the file to UTF-8 with BOM, the BOM is permanently there That's normal. You should save UTF-8 files without BOM, but e.g. Notepad won't let you do that AFAIK. Other text editors may have BOM settings in the Preferences that you may have to check. I don't know if saving a UTF-8 file in Notepad as ANSI actually removes an existing BOM --I'd hope so, but haven't tested. In any case Notepad is such a primite text editor that it's best avoided anyway. Personally I use TextPad, but it's not ideal for working with UTF-8 (Unicode) either. |
Lo-Fi Version | Time is now: 19th April 2024 - 10:12 PM |