Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sandro Mastronardi 11 posts 69 karma points
    Sep 15, 2014 @ 17:18
    Sandro Mastronardi
    0

    UTF-8 file with BOM causes DateTime.Parse to fail

    If the log file becomes an UTF-8 file for some reason unknown to me, the parsing of the date fails... the substring(0,19) will then get an invisible character (called the ByteOrderMark) and it will have one digit less of the seconds... causing the parse to fail most probably already because of the invalid character over the missing digit.

    It would be nice if the code would strip the BOM, if present, before trying to split and parse the lines....

    More info can be found here: http://stackoverflow.com/questions/1317700/strip-byte-order-mark-from-string-in-c-sharp

    Hope it helps, nice work on the package!

    Best regards,

    Sandro Mastronardi

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 15, 2014 @ 17:51
    Sebastiaan Janssen
    0

    Unfortunately I couldn't reproduce the problem here but that could have something to do with different locales or something else interesting. I've submitted a pull request to fix this though, should help in your case. :)

    https://github.com/DanDiplo/UmbracoTraceLogViewer/pull/3

    Would be great if you could test, download this zip, backup your bin and App_Data folder and unzip the files from the zip into the root of your site. You might need to clear the cache in your browser before loading the log files (not sure if there's changes to the client side components but it doesn't hurt).

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 15, 2014 @ 17:54
    Sebastiaan Janssen
    0

    Hang on, fix was wrong, fixing correctly now =)

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 15, 2014 @ 18:07
  • Sandro Mastronardi 11 posts 69 karma points
    Sep 16, 2014 @ 11:00
    Sandro Mastronardi
    0

    Hi Sebastiaan,

    Thanks for the quick response, I have tried the update but it doesn't work...
    I have a sample log file that causes the exception (not all logfiles have it)

    Can't seem to send you a PM so I'll post a link here (one time download, one day valid, pass: sandro)

    http://nmd.sk/wkjTNFJ6

    Best,

    Sandro 

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 16, 2014 @ 20:20
    Sebastiaan Janssen
    0

    Thanks Sandro, fixed the problem properly now, would be nice if you can confirm but with this log file I don't have that problem any more.

    Updated dll: https://dl.dropboxusercontent.com/u/3006713/Diplo.TraceLogViewer.dll.zip

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies