phpDivingLog Text Formating

3rd party extensions (phpDivingLog, dive computer downloader,...)
Post Reply
lloyd_borrett
Posts: 228
Joined: Sun Jun 11, 2006 09:24
Location: Frankston South, Victoria, Australia
Contact:

phpDivingLog Text Formating

Post by lloyd_borrett »

G'day,

Since switching to Diving Log 5.0, I'm getting some strange results when exporting the data and viewing it with phpDivingLog.

The comments created and saved with Diving Log 5.0 are shown without spacing:
See http://www.borrett.id.au/divelog/index.php?nr=294

Yet text in the database that was created and saved in earlier versions of Diving Log still appear with spacing:
See http://www.borrett.id.au/divelog/index.php?nr=199

Any ideas as to why and how it can be fixed?

Best Regards, Lloyd Borrett.

lloyd_borrett
Posts: 228
Joined: Sun Jun 11, 2006 09:24
Location: Frankston South, Victoria, Australia
Contact:

Re: phpDivingLog Text Formating

Post by lloyd_borrett »

Some additional information.

Diving Log 5.0 is running under Windows 7.
RTF2Plaintext is set to True as it was for DL4.
DL5 is exporting the file to a GZip file. With DL4 it was a text SQL file.
DL5 is set to use UTF8 encoding. DL4 didn't have this setting.
phpMyAdmin is using UTF8 for the character set.

Best Regards, Lloyd Borrett.

divinglog
Site Admin
Posts: 5174
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: phpDivingLog Text Formating

Post by divinglog »

I think in phpDivingLog you are replacing chr(10) & chr(13) characters in the comments with a <br> tag. I think for some reason Diving Log 5.0 exports maybe just a chr(10) or a chr(13), so you could add an additional replace function.

lloyd_borrett
Posts: 228
Joined: Sun Jun 11, 2006 09:24
Location: Frankston South, Victoria, Australia
Contact:

Re: phpDivingLog Text Formating

Post by lloyd_borrett »

I suspect the problem is that DL5 saves the comment data differently to DL4, not that it exports it differently.

The comments fields on dives that were saved by DL4 are still okay. It's only on the dives saved in DL5 that the problem occurs.

If I change phpDivingLog to add in extra breaks, it's not going to be a solution because then the earlier dives will have too many breaks.

The solution is probably to have DL5 save the dives the same as DL4.

Best Regards, Lloyd Borrett.

divinglog
Site Admin
Posts: 5174
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: phpDivingLog Text Formating

Post by divinglog »

Version 4.0 is a .NET application and I'm using the normal RTF component, which is probably different from the VB6 RTF component, so I can't do much about how the comments are saved into the DB. The only thing I could do is tweaking the MySQL export.

lloyd_borrett
Posts: 228
Joined: Sun Jun 11, 2006 09:24
Location: Frankston South, Victoria, Australia
Contact:

Re: phpDivingLog Text Formating

Post by lloyd_borrett »

Another work around would be to go through and save every dive using DL5. Then adjust phpDivingLog so that it works with DL5 saved dives.

I'll look into it a bit more and see what's actually in the comments field.

Best Regards, Lloyd Borrett.

lloyd_borrett
Posts: 228
Joined: Sun Jun 11, 2006 09:24
Location: Frankston South, Victoria, Australia
Contact:

Re: phpDivingLog Text Formating

Post by lloyd_borrett »

Okay, I've implemented a fix.

DL4 outputs \r\n for every line break.
phpDiving log was converting this to <br>\n

DL5 just outputs \n for every line break.
So by adding a replace \n\n with <br>\n<br>\n to phpDivingLog, I think I've fixed the problem.

Best Regards, Lloyd Borrett.

divinglog
Site Admin
Posts: 5174
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: phpDivingLog Text Formating

Post by divinglog »

Hi Lloyd

Yes, that's what I meant in my first reply. I can also do the replace in my export, but it will take a little longer as I'm going into vacation on Friday, so your solution is probably faster implemented.

Best regards,
Sven

Post Reply