|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Scream, sorry to bother you again: Our friend, the MAC/IE -line break bug, is still there.
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
I still haven't been able to figure this one out. According to the php manual the fucntions I'm using are supposed to catch all forms of line breaks. But, it's hard to test this since I don't have a mac. Anyone know if there is a browser emulator for this?
UBB.threads Developer
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Scream, I think I found it!!!! AND THE WINNER IS........... In Addpost.php, replace // --------------- // Add break tags $PrintBody = str_replace("\n","<br>",$PrintBody); by // --------------- // Add break tags $PrintBody = str_replace("\n","<br>",$PrintBody); $PrintBody = str_replace("\r","<br>",$PrintBody); //HACK MAC and // --------------- // Add break tags $Body = str_replace("\r","<br>",$Body); by // --------------- // Add break tags $Body = str_replace("\n","<br>",$Body); $Body = str_replace("\r","<br>",$Body); //HACK MAC Mac uses different line breaks than Unix and PC. A browser should be able to convert that right, but IE5 obviously doesn't. I tried different special symbols in REgular expressions, and \r dit it... If you put it in this beta to all occurences of a break-replace, i could try it out here.. I am sure that my code at least will not harm []/forum/images/icons/wink.gif[/]
Last edited by caymuc; 04/21/2002 1:52 PM.
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
Now that you mention this I know I have read something about this elsewhere... not sure where though. LoL (that is about having the \r return carriage after the \n new line for Mac IE. Mac NS ok too?
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Mac/NS never had a problem with that problem. That is only Mac/IE releated (...with compliments from Bill []/forum/images/icons/grin.gif[/] ).
Last edited by caymuc; 04/21/2002 2:07 PM.
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Right thinking, too quick the "solution"... []/forum/images/icons/blush.gif[/] My code works for MAC now, but not for PC this time, it seems to add extra <br> sometimes there... I play around and try to come with something better.
Last edited by caymuc; 04/21/2002 5:00 PM.
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
Does the Mac have bot \r\n at the end of the strings? Why not remove the \r and line break the \n ? (that's only if it has both) []/forum/images/icons/smile.gif[/]
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Ok, I think I'll need to change the regex so it just matches one and not both. Thanks for the fix!
UBB.threads Developer
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Ok, this should do it: $Body = eregi_replace("(\n|\r\n)","<br />",$PrintBody);
UBB.threads Developer
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
not working MAC/IE uses /r (chr13) INSTEAD of /n I found out
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
So it should be this: $Body = eregi_replace("(\r|\n|\r\n)","<br />",$PrintBody); (maybe even throw in a \n\r for good measure) []/forum/images/icons/smile.gif[/] LoL
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Ok, to cover all bases, we could use: $Body = eregi_replace("(\n|\r\n|\n)","<br />",$PrintBody);
UBB.threads Developer
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Beat me to it []/forum/images/icons/wink.gif[/]
UBB.threads Developer
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
just thinking... shouldn't \r\n come first as the other two will modify \r\n seperately?
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
Hmm, you might be right on that. Should change it that way just to be safe.
UBB.threads Developer
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
2 options with \n ? Are the options in RegEx read from right to left? Not that /n is replaced, before /r/n is checked?
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
Try $Body = eregi_replace("(\r\n|\n|\r)","<br />",$PrintBody); Does the back slash need to be made literal? that is \\r\\n|\\n|\\r ?
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Tested this code POSITIVE on Mac(9.1) AND PC for both IE5 and NS4.x (tested for New message with Preview and Change Message): $Body = eregi_replace("(\n\r|\r\n|\r|\n)","<br>",$Body); //HACK MAC (Vers. 5.5.1!) Not tested yet on Unix, unicode, MacOS 10, but I believe it works there too. I think I have one option to much in it, but it does not hurt this time, and this time it seems to be the right order of the options...
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
eregi_replace("(\r\n|\r|\n)","<br>" ... seems to work too (one option less...) Now I changed the code in: addpost.php changebasic.php mess-reply.php modifypost.php previewedit.php sendmessage.php showflat.php showthreaded.php I do not think it was always necessary here besides addpost, but i did it anyway... Am I right with this?
|
|
|
|
Joined: Oct 2000
Posts: 60
Power User
|
Power User
Joined: Oct 2000
Posts: 60 |
OK, I'm going to clarify this even though this has already been fixed. In text files... UNIX systems use the New Line character (\n) at the end of each line Mac systems use the Carraige Return character (\r) at the end of each line DOS/Windows systems use Carraige Return and New Line character (\r\n) at the end of each line It seems that web browsers inherit this from their OSes.
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
You would not believe how happy I am that this bug is finally fixed (I use Mac myself). - From your explanaion I see that our try & error experriments where just right. I wonder when ThreadsDev.com will have that Fix installed (hint hint) *g*
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
I'm a mac user too.. But I'm confused as to exactly what lines of code to change to what in the files you've listed.... or will Rick put this in the upcoming release? Will your fix work on 5.5.1??? Love to get this fixed for my own use ASAP.
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
The fix works well in 5.5.1. - I run it on my forums and no problems ever since with it here. I am sure Scream put it in V.6. as this bug was annoying for all of us. And as I heard we can expect V.6. in a couple of days already. If you don't want to update anyway, I can write here accurate instructions to hack 5.5.1: write me a mail...
|
|
|
|
Joined: Jul 2001
Posts: 12
Newbie
|
Newbie
Joined: Jul 2001
Posts: 12 |
What i'm surprised at is that the PHP nl2br() function doesn't handle for all of those cases - only \n.
|
|
|
|
Joined: Jan 2001
Posts: 374
Enthusiast
|
Enthusiast
Joined: Jan 2001
Posts: 374 |
Due to public request: My fix would be like this for 5.5.1: Search fot this string in all documents (MAC BBEdit use "Multifile Search in Folder"): [:red]str_replace("\n","<br>",[/] Replace that with this string: [:red]eregi_replace("(\r\n|\r|\n)","<br>",[/] The searched/replaced code is a part string of other code, make sure you do not touch the rest. Done. (Use usual precortions: make a backup of all code first, just in case something goes wrong!) Scream, and others here, please correct me if I am wrong. []/forum/images/icons/smile.gif[/] Greetings
Last edited by caymuc; 05/01/2002 1:30 PM.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|