She call me Mr BomBastic say me fantastic

Ok, so this post has nothing to do with shaggy and his 90’s hit, and yes its spelt wrong anyway. The point here is that certain web files for this site were saved using regular notepad on a windows machine, this wasn’t a problem until the latest update to the wordpress app for iphone, the problem in question is the BOM BOM BOM BOM. When the app tried to log into a self hosted wordpress blog an error would pop up saying “blog returned invalid data”. This was due to windows notepad adding the BOM byte code at the beginning of php and javascript files. There is also a warning on this when trying to validate using http://validator.w3.org or at least there is when validating html 5.

***Update****
Thanks to Brandon in the comments for pointing out there are also some plugins that have the same problem, the fix below should still work, but to cut some time and stress, he suggests to deactivate all plugins and add them back one at a time to locate which one(s) maybe causing the problem. Thanks Brandon.

The solution….

The simple work around i found was to use an ftp client like the free filezilla from http://filezilla-project.org/ to download any files that may have been saved in notepad when messing around with either the theme or the config file. Then use notepad++ another free app from http://notepad-plus-plus.org/ to open the files and convert to utf-8 without BOM. This takes a little time though, but you should be able to drag a group of files or a folder onto notepad++ to open them all and then just go a tab at a time and go to encoding ->convert to utf-8 without BOM, then save it and move on. when finished, right click a tab and select “close all but me” to get rid of the 20 odd tabs you might have if you dragged the entire theme folder into notepad++. next step is to re upload the files to you server with filezilla. And that should be done and now working again, plus with the added bonus of 1 less warning on the validator page. 🙂

There is also a setting in the settings->preferences ->New Document/Default DIrectory tab that sets the default encoding type, and can be applied to opened ANSI files. Though it does not recognise this as a change enough to save straight away, so either typing something in and deleting it would be necessary to save as the new encoding type. As of yet i have not found a way to batch encode, even with macros. Sorry

As a last note. I should point out that notepad++ is an amazing text editor, especially for developers on a shoe string budget, or who find dreamweaver just to clunky when all that’s needed is a little tweak here and there to a file. It has support for recognising and colour highlighting all sorts of programming/scripting languages, run macros, and even use a spell checker for regular text documents (need to download dictionary first though). All this and more in a light weight application that doesn’t necessarily need to be installed, just unzip the file and start using, or even point files to the notepad++.exe application file as the default app for a file type. The zip file actually gives 2 directories for different version of the app, unicode and ansi. Ansi isn’t in the install version as this will eventually be dropped, so unicode is the version to go for.

This entry was posted in General, iPhone and iOs, lartens, PC, Quirks, Tech and tagged , , , , , , , , . Bookmark the permalink.

8 Responses to She call me Mr BomBastic say me fantastic

  1. Thomas Roten says:

    Thanks for posting this. It worked perfectly for me. I almost never use Windows to code, but I guess somewhere along the line I must have for a file or two.

  2. Great information! However, for me it was actually a number of plugins, mainly WP-DB-Backup, WP-Backup by BTE and All in One Adsense and YPN. I would first try turning all plugins off then turning them back on one by one before doing all this reformatting work. Thanks!

  3. Mike Haydon says:

    Thanks for this. It was one of my plugins causing the problem. As soon as I deactivated it the problem was solved. Thanks also to Brandon for that comment. Saved me a few hours!

  4. lartens says:

    Thanks guys for your contribution, updated the post for any new comers with proper thanks to Brandon for his tip, cheers

  5. Pingback: WordPress für iOS Update: Blog returned invalid data | Niklas Rother – XNA, Computer & mehr

  6. Okay, so I think I found the 3 plug-ins that were causing my problem. (It works fine with these 3 off.) How do I go about fixing them? The plugins (wp-count, wp-db-backup, and wp-super-cache) are all very important to maintaing my blog and I don’t like having them off.

    Am I suppose to convert all the plugin files to utf-8? I tried that with wp-db-backup, and I’m still getting the error. (The .mo language files always revert back to ANSI after I convert them and save them.) I don’t think I’m doing it right.

  7. Kevin says:

    The problem is the same on the iPad so any ideas out there how to resolve it

Leave a Reply

Your email address will not be published. Required fields are marked *