kristopherjohnson / Markingbird

Markdown processor written in Swift (translation of MarkdownSharp)
Other
385 stars 76 forks source link

Fix for issue #2 #7

Closed dhogborg closed 8 years ago

dhogborg commented 8 years ago

Fix for issues with Unicode scalar values in normalize function.

fatal error: high- and low-surrogate code points are not valid Unicode scalar values (lldb)

I ran into this and made an attempt to fix it by replacing the String/NSString-mixed implementation with an all String variant

It passes all the tests provided in mstest-0.1/ and has 100% code coverage. All other tests are unaffected. It also works with the markdown that previously crashed it.

kristopherjohnson commented 8 years ago

Thanks for this fix. I haven't tested it, but from a quick review it looks like it will no longer strip/convert "\r" values. Not sure how big a deal that is to most users, but I'd like to keep it working the same way.

dhogborg commented 8 years ago

That was a mistake on my part. There were no \r were part of the test suite (even though there are some in mstest-0.1) and so the conversion was never used and I made the mistake of thinking the carriage returns where handled elsewhere when code coverage reported 0 hits on that block.

I added some tests for \r\r and \r\n to asses how swift handles them and the code is now updated to convert them both to \n\n and \n respectively. As per original implementation.

kristopherjohnson commented 8 years ago

Thanks, this is great!