Yesterday I installed a fresh copy of WordPress on a subdomain of this site. I used Fantastico’s autoinstall feature, so I got the WP 2.2.2 version. I left the visual editor enabled because I was feeling lazy. Today was writing a post using that new WP install and noticed that some lines where wrapping at strange places. After saving the draft I viewed the post in different browsers and verified that the unusual line breaks were visible outside of the visual editor, too.
There were no extraneus <br> or <p> tags in the HTML code and – after a lot of tinkering – I concluded that the theme/CSS was fine, too. Searching Google for “WordPress line break problem” turned up a number of pages, but none of them dealt with the exact problem I had (looks like WP has had lots of other line-break related issues). My “programmer’s intuition” hinted that the problem might actually stem from page encoding/character set bugs.
Long story short, it turned out that some the spaces in my post were Unicode spaces while some were… of some other kind. For some reason this causes web browser(s) to do strange word wrapping.
What I did was this :
- Turn off the visual editor.
- Edit the post.
- Copy all the contents to Notepad.
- In Notepad, select one space and copy it (Ctrl+C).
- Edit -> Replace…, paste the copied space in the first box and type a normal space in the other box.
- Hit Replace All.
- Copy the text back to the post and save.
I also applied a charset encoding hack to my wp-config.php. All this combined solved my line break problem.Related posts :