We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you try this, it does not substitute the entities: NSString * example = @"Title 🚓🚌🚒🚖"; NSString * result = [example stringByDecodingHTMLEntities];
Here is the fix (GTMNSString+HTML.m from line 481): NSScanner *scanner = [NSScanner scannerWithString:hexSequence]; unsigned long long value; if ([scanner scanHexLongLong:&value] && [scanner scanLocation] == length - 4) { if (value < USHRT_MAX) { unichar uchar = value; NSString *charString = [NSString stringWithCharacters:&uchar length:1]; [finalString replaceCharactersInRange:escapeRange withString:charString]; } else if ( (value & 0xFF000000) == 0 ){ value -= 0x10000; unichar highSurrogate = value >> 10; // leave the top 10 bits highSurrogate += 0xD800; unichar lowSurrogate = value & 0x3FF; // leave the low 10 bits lowSurrogate += 0xDC00; NSString *charString = [NSString stringWithCharacters:(unichar[]){highSurrogate, lowSurrogate} length:2]; [finalString replaceCharactersInRange:escapeRange withString:charString]; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If you try this, it does not substitute the entities:
NSString * example = @"Title 🚓🚌🚒🚖";
NSString * result = [example stringByDecodingHTMLEntities];
Here is the fix (GTMNSString+HTML.m from line 481):
NSScanner *scanner = [NSScanner scannerWithString:hexSequence];
unsigned long long value;
if ([scanner scanHexLongLong:&value] && [scanner scanLocation] == length - 4) {
if (value < USHRT_MAX) {
unichar uchar = value;
NSString *charString = [NSString stringWithCharacters:&uchar length:1];
[finalString replaceCharactersInRange:escapeRange withString:charString];
} else if ( (value & 0xFF000000) == 0 ){
value -= 0x10000;
unichar highSurrogate = value >> 10; // leave the top 10 bits
highSurrogate += 0xD800;
unichar lowSurrogate = value & 0x3FF; // leave the low 10 bits
lowSurrogate += 0xDC00;
NSString *charString = [NSString stringWithCharacters:(unichar[]){highSurrogate, lowSurrogate} length:2];
[finalString replaceCharactersInRange:escapeRange withString:charString];
}
The text was updated successfully, but these errors were encountered: