Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Saving html record crashes editor

We have some html templates stored as a record in an OI table.

We use these for sending nicely formatted emails within outlook. Works well.
If however, we open them in the editor and then try and save them OI crashes.

here's an example

Comments

  • Mark,

    Can you post the HTML code or email it to support@srpcs.com? That way we can test it ourselves.
  • <!DOCTYPE HTML> <html> <head> </head> <body style="overflow-x:hidden;overflow-y:scroll;"> <div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 10pt"> <p>Good afternoon [NAME],</p> <p><br> Please find attached your invoice/s for week ending [WEEK_ENDING]</p> <p> </p> <p>If you have any queries please don't hesitate to contact me.<br><br> Kind Regards,</p> </div> <div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 10pt"> <strong>[MY_NAME]</strong><br><br> [MY_TITLE] <p><img src="http://powerforce.sms-designs.com/email_img/edmen_logo.gif"></p> </div> <div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 8pt"> <p><strong>T: 1300 665 880</strong> F: 1300 665 917<br> E: <a href='mailto:[MY_EMAIL]'>[MY_EMAIL]</a><br> W: <a href='http://www.edmen.com.au'>www.edmen.com.au</a></p> <p style='font-weight:bold;font-style:italic;'>Proudly supporting the National Disability Insurance Scheme <a href='http://www.ndis.org.au'>www.ndis.org.au</a></p> <p style='color:#808080;font-style:italic;'><img src="http://powerforce.sms-designs.com/email_img/fly_carbon_neutral.gif">Edmen Group chooses to fly carbon neutral for all domestic business air travel.</p> <p style='color:#808080;font-style:italic;'>Please consider the environment before printing this e-mail message.<img src="http://powerforce.sms-designs.com/email_img/environment.gif"></p> <p style='color:#000080;font-style:italic;'>CONFIDENTIALITY NOTE: This message is intended for the addressee above mentioned and may contain confidential information.<br> Access to this email by anyone else is unauthorised.<br><br> If you are not the intended recipient, please delete this message and notify the sender as any disclosure, copying, distribution or any<br> action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. Views expressed in this message are those of the individual<br> sender, and are not necessarily the views of the Edmen Group</p> </div></body> </html>
  • Not sure if that will work for you but give it a go.
    Note that if we just copy/paste from text file, it automatically inserts as a record with many fields.
    This saves fine but is not what we need.

    The html needs to be in a single field for us to use it (like in the original screenshot) but that is also when the crash happens
  • Mark,

    How do you normally store this long string in OI? Also, have you tested other editors?
  • Just tried saving it in the old system editor and it didn't crash but it saved each line as a separate field which is not what we want.
  • Mark,

    I'm still confused as to how you are getting this inserted into an OI database record in the first place without the field marks. Alternatively, what steps are you going through that causes the crash to occur?

    FWIW, @LF or @CR/LF delimited data will convert to @FM by design. May I ask why this causes problems for your application? I mean, I realize @FM won't work, but presumably you pull this data out via code anyway and then pass it along to another process. Why can't you swap the delimiters en route?
  • Basically osread htmlfile then write to file.

    It works on the basis that the user can download a template, edit as they wish in some html editor and then 'import' into OI.

    That's how it gets inserted.

    If we then open the record in the editor and simply do a 'Save As', OI crashes before saving.

    Why can't we swap delimiters en route? I don't know offhand. The code exists and works and is deep in the bowels of the app where I am wary to tread. What concerns me is that there must have been a reason for the current approach to be taken and I don't know what that is nor what I might break if I begin to experiment.

    Regardless, having OI crash on a 'save' in the editor is a little concerning and I thought it may be something you guys could easily address.
  • Regardless, having OI crash on a 'save' in the editor is a little concerning and I thought it may be something you guys could easily address.
    Yes, I have not overlooked your original concern in this. My questions were meant to isolate the nature of the issue but I was also trying to understand the use case better.

    I can replicate the problem, albeit sometimes the Save As actually works. Go figure.

    I am convinced the problem is related to the embedded LF characters. If I strip those out and convert the HTML into a true non-delimited string then I have no problems doing a Save As with the content all day long. Perhaps this might be a work around for you...unless the LF characters are also a necessary for your app.

    It is also interesting, as you noted, that the OI editor (actually, all of them) won't even try to store LF characters but instead converts them to @FM. Kevin has made a note of your issue for the SRP Editor, but I am not sure (as of yet) if this is easy to address. We'll keep you posted.
  • Usually, when the SRP Editor saves a document, it just pulls the bytes out of the editor control and writes them. That is not the case, however, with Records. Records have to examine each line one by one because there is a lot of smoke and mirrors to making delimiters work. The algorithm has to determine if the line break should be saved as a line break or a delimiter. The problem was that, in the event that a line break was just a line break, I was always pushing CRLF into the buffer. But your HTML was using only LF for line breaks, and as a result, I was writing characters past the boundaries of allocated memory. Ergo, crash.

    If you download SRPUtil.ocx 4.0.2 RC1 and register it, the crash should no longer present itself, as I updated the algorithm to use the same line break characters as the document itself.
  • Hi Kevin,

    Should the line breaks be displaying in routines as well?

  • Oops. That was for debugging purposes. Get 4.0.2 RC2 if you want those to go away.
  • Thought it might've been.

    Thanks
  • Hey Kevin,

    Did 4.0.2 RC2 have some effect on the display of line numbers?


  • Ah yes. I forgot I had been working on some changes some time ago that affected the line numbers. It's not so much a problem with just 4.0.2 RC2 as much as it is a change in 4.0.2 that requires a change in the SRP Editor code itself. I'll work to get an update to you as soon as possible.
  • Thanks Kev.
  • edited June 2016
    Sorry for the delay, but I was trying to get a major feature for the next release of the SRP Editor completed. If you are still struggling with the minuscule line numbers, you'll have to download the full beta build of SRP Editor 2.8 RC1. The ZIP file contains both an RDK and a new SRPUtil.ocx build. Install the RDK using RDKINSTALL and register SRPUtil.ocx using regsvr32. Let me know if you have any questions.
Sign In or Register to comment.