Comments (9)
I have the same issue with utf-8 characters like 'ü', 'ö' and so on! Is there a way to fix this?
from markdown.
Same issue here. Looks like string length is incorrectly computed when dealing with unicode characters.
from markdown.
I 'hacked' it in my app by counting non-standard characters and adding spaces in the end of string. Not pretty, but worked.
from markdown.
@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.
from markdown.
@dimitry yes, something like that. Here you have a few ways to implement it:
http://stackoverflow.com/questions/4191168/how-can-i-count-the-number-of-non-alphanumeric-characters-in-an-nsstring-object
from markdown.
@burczyk spot on! Thank you for your help. And thank you @myell0w for UTF8 support.
from markdown.
It would be awesome if you could create a sample repository with your fix so other can use it. Thanks guys!
from markdown.
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!
from markdown.
Hi guys, here is a fix for this issue #12.
But I faced with another problem, as described here (#2) non-ASCII characters missed...
from markdown.
Related Issues (17)
- Please add semantic version tags
- Multiple links support breaks the parsing HOT 4
- if the string include chinese,after parse ,chinese can not show on the TTTAttributedLabel HOT 1
- Non-ASCII Characters HOT 12
- Link in text can cause crash HOT 2
- CocoaPods HOT 1
- Doesn't parse some accented characters (i.e. é) HOT 2
- Some features don't work as you mentioned
- Umlauts are removed
- Accents and £ sign don't parse
- #if instead of #ifdef?
- Wiki error
- #import "fmemopen.h" not found
- Font caching currently doesn't work
- fmemopen is missing HOT 4
- Flex Unused Entity Issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown.