News:

Wondering if this will always be free?  See why free is better.

Main Menu

Re: I get this:  on my SMF Forum. Why?

Started by ModelBoatMayhem, January 14, 2013, 01:15:28 PM

Previous topic - Next topic

ModelBoatMayhem

I'm getting the same  top left of the Forum...

Should I be worried?
Where do I start looking to fix it?

SMF 2.03
That's my firm opinion.... but what do I know?!

Arantor

Download all the PHP files in your site (except Subs-Charset.php), open them in a decent text editor like Notepad++ (not Notepad) and then tell it to convert to UTF-8 Without BOM.

ModelBoatMayhem

That's my firm opinion.... but what do I know?!

Arantor

Nope. The code files themselves have UTF-8 encoding, and that's confusing things.

HunterP

Quote from: Arantor on January 14, 2013, 01:17:14 PM
Download all the PHP files in your site (except Subs-Charset.php), open them in a decent text editor like Notepad++ (not Notepad) and then tell it to convert to UTF-8 Without BOM.

It could also be the CSS.

Arantor

Not when it's appearing in the main page it couldn't.

ModelBoatMayhem

Quote from: Arantor on January 14, 2013, 01:17:14 PM
Download all the PHP files in your site (except Subs-Charset.php), open them in a decent text editor like Notepad++ (not Notepad) and then tell it to convert to UTF-8 Without BOM.

OK, it's snowing here (England) so I'll try that tomorrow.
( About how many files should I be looking for? )
That's my firm opinion.... but what do I know?!

Arantor

(I'm in England, I've been out in both the snow and rain today)

Everything in Sources (about 100 files in SMF 2.0 IIRC, do not edit Subs-Charset.php!) and any in your Themes/ folders, but can't remember how many that is.

MrPhil

Someone used an idiot editor on one or more files that "helpfully" added a Byte Order Mark (BOM, those three funny characters) to the very beginning of one or more files, because it understood the files to be UTF-8. The BOM will not be visible when seen with the PC or page in UTF-8 mode (you need to switch to a single byte encoding, such as Latin-1, to see it). In either case, it will cause a "headers not sent" PHP error if it shows up too early. In single-byte encoding, the BOM itself will be visible at the top of the page.

Most UTF-8 capable editors can be told to explicitly save files without a BOM. Many Microsoft editors will automatically add a BOM, so be careful. Or, you can edit in single-byte encoding mode (e.g., Latin-1), where you'll be able to see and erase the BOM characters, then save the file. Be careful in the process that you don't add leading blanks or lines, or trailing blanks or lines to the file.

ModelBoatMayhem

#9
Hi Mr Phil.

Thanks for you help... again!

I've just had a quick look at this and tested the files in the root dir. index.php, settings.php, etc.

I opened the file in Notepad ++  (edit)
[Tool bar]  Encoding > Encode UTF-8 Without BOM

same with:

[Tool bar]  Encoding > Convert UTF-8 Without BOM

it doesn't register any changes to the file that need to be saved and allows me to close the files without saving them - is this correct ?
That's my firm opinion.... but what do I know?!

Storman™

QuoteI opened the file in Notepad
[Tool bar]  Encoding > Encode UTF-8 Without BOM

Do you mean Notepad++ ?

"Notepad" and "Notepad++" are completely different applications. Make sure you use the latter.

ModelBoatMayhem

#11
Sorry, Notepad++

That's my firm opinion.... but what do I know?!

ModelBoatMayhem


Also, 2 other things:

1. I've checked about a dozen files and they all end with   ?>

2. Doing a 'View Page Source'  shows
:

Quote

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <link rel="stylesheet" type="text/css" href="http://www.mysite.co.uk/forum/Themes/core/css/index.css?fin20" />
    <script type="text/javascript" src="http://www.mysite.co.uk/forum/Themes/default/scripts/script.js?fin20"></script>
    <script type="text/javascript" src="http://www.mysite.co.uk/forum/Themes/core/scripts/theme.js?fin20"></script>


That's my firm opinion.... but what do I know?!

Kays

The fie to look in is Display.template.php and the following line seems to case some editors to save that file as UTF-8.


// Show "� Last Edit: Time by Person �" if this post was edited.


For a start, ensure that file is encoded as ANSI and not UTF-8.

You can also try either removing the "�", or replacing it with a standard character such as a question mark. "?"

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

MrPhil

Isn't there an SMF utility (tool) floating around somewhere that looks for leading/trailing whitespace as well as BOMs, and fixes them?

Try http://www.simplemachines.org/community/index.php?topic=329069.0

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

ModelBoatMayhem

#16
OK, I've run File_check.php and got this....

       /forum/attachments/131804.php
        File does not begin with <?php
        File does not end with ?>

       /forum/index_old.php
        File does not begin with <?php
        File does not end with ?>

       /forum/Sources/StopSpammer.php
        File does not end with ?>

       /forum/temp/faulty tables-files/main_data/messages.php
        File does not begin with <?php
        File does not end with ?>

       /forum/Themes/core/Display.template.php
        UTF-8 BOM found

       /forum/Themes/default/Display.template.php
        UTF-8 BOM found
That's my firm opinion.... but what do I know?!

Kays

You probably can ignore all but the last two items.

Download Display.template.php, open it Notepad++ and change the encoding to ANSI. Also edit that line I suggested in my other post as it does force Notepad++ to open it as UTF-8. Although it's without BOM, that file should be saved as ANSI.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

ModelBoatMayhem

#18
Display.template.php now saved as ANSI and uploaded.

This is what I found in the files....

Core

Quote
        // Show "« Last Edit: Time by Person »" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name']))
            echo '
                        « <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> »';



Default
Quote// Show "� Last Edit: Time by Person �" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name']))
            echo '
                                « <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> »';

        echo '
                            </div>
                            <div class="smalltext reportlinks">';
That's my firm opinion.... but what do I know?!

Kays

Since the topic you jumped on is rather old, I split this off from that topic.

And since it looks like that took care of your problem I'll mark this as solved. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

ModelBoatMayhem

QuoteDownload Display.template.php, open it Notepad++ and change the encoding to ANSI. Also edit that line I suggested in my other post as it does force Notepad++ to open it as UTF-8. Although it's without BOM, that file should be saved as ANSI.

Well that seems to have fixed it for me!
Many thanks chaps,  1st round is on me.
   :)
That's my firm opinion.... but what do I know?!

Advertisement: