-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 last characters missing #6
Comments
I have the same issue with utf-8 characters like 'ü', 'ö' and so on! Is there a way to fix this? |
Same issue here. Looks like string length is incorrectly computed when dealing with unicode characters. |
I 'hacked' it in my app by counting non-standard characters and adding spaces in the end of string. Not pretty, but worked. |
@burczyk I'm completely content to do that at this point :) Project needs to launch. Any code snipped to help me get there as well? Are you just counting how many chars are 128 and above? Thank you. |
@dimitry yes, something like that. Here you have a few ways to implement it: |
It would be awesome if you could create a sample repository with your fix so other can use it. Thanks guys! |
I used @myell0w's fork and then added blank spaces to the end of the markdown string (before sending it to the parser). Here's a quick copy & paste: NSString *markdown = @"...."; // Your markdown string
// Count non-standard characters
NSUInteger length = [markdown length];
NSUInteger totalNonStandardCharacters = 0;
for(int i=0; i<length; i++) {
if ([markdown characterAtIndex:i] > 127) {
totalNonStandardCharacters++;
}
}
// Make string with spaces (to pad the original text)
NSMutableString *padding = [[NSMutableString alloc] init];
for(int i=0; i<totalNonStandardCharacters; i++) {
[padding appendString:@" "];
}
// Add padded spaces to the end of the string
markdown = [NSString stringWithFormat:@"%@%@", markdown, padding];
// Now send it to the parser I think there's a cleaner way to create an empty string with X number of spaces, but no time for it right now. Quick & dirty! |
I cloned repo from @myell0w
4e649d4
and I saw that after parsing markdown utf-8 text 2 last characters are missing.
Does anyone have the same problem?
The text was updated successfully, but these errors were encountered: