kristopherjohnson / Markingbird

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

Unicode Error? #2

Open Riccardo99 opened 9 years ago

Riccardo99 commented 9 years ago

Hi, I'm tried to parse a this markdown text to html:

As representações esquemáticas da força de atrito *f*𝒂𝑡 entre os pneus e a pista, em função da pressão *p* aplicada no pedal de freio, para carros sem ABS e com ABS, respectivamente, são:

And I got this error:

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

I think the error could be associated withing use special characters like: 𝒂 or 𝑡

Can someone fix this or help me with this problem?

Thanks :)

kristopherjohnson commented 9 years ago

The text-encoding handling in Markingbird isn't very good right now. While translating the C#/.NET code over to Swift, in some places I use NSString, and other places I use Swift's standard String, and when it goes down to the level of individual characters, it is treating them as 8-bit bytes, and not properly dealing with UTF8 sequences.

All I can suggest for now is to run it in a debugger to figure out where it is finding that error, and fix it, or re-implement the NSString/String handling. I may eventually do this myself, but don't know when.