-
Notifications
You must be signed in to change notification settings - Fork 370
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
modified JSONPayload to replace non-utf8 character as � #654
modified JSONPayload to replace non-utf8 character as � #654
Conversation
|
Sorry, I force pushed to change the author, I used my work acc. |
Thank you! |
*/ | ||
+ (NSString*) makeValidUTF8:(NSString*) stringToCheck | ||
{ | ||
if (![FBResponseJSONPayload isValidUTF8 :stringToCheck]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same below. New methods must follow the same style as the other code
NSMutableString* fixedUp = [NSMutableString stringWithString:@""]; | ||
for (NSUInteger i = 0; i < [stringToCheck length]; i++) | ||
{ | ||
@autoreleasepool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. ARC is enabled for this project
- (instancetype)initWithDictionary:(NSDictionary *)dictionary | ||
httpStatusCode:(HTTPStatusCode)httpStatusCode | ||
{ | ||
NSParameterAssert(dictionary); | ||
if (!dictionary) { | ||
return nil; | ||
} | ||
|
||
NSMutableDictionary* newDictionary = [NSMutableDictionary dictionary]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather make this check local for the getSource endpoint only. Changing it for all endpoints might break backwards compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also from the compatibility perspective it makes sense to put this behavior under a setting and disable it by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on you to check it only on getSource endpoint.
Sure, I can add another settings. Would you like replaceUnsupportedUnicodeCharacters
for the name of a setting?
*/ | ||
+ (NSString*) removeInvalidCharsFromString:(NSString*) stringToCheck | ||
{ | ||
NSMutableString* fixedUp = [NSMutableString stringWithString:@""]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something like that would be faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my case, I was viewing a Korean webpage, so it probably did not contain accents or umlauts. However I will take a look if there is any other builtin methods to make it more simple and fast. Thank you.
@jakobtak Do you have time to finish the PR? |
Sure, I've forgot to finish it. I will wrap the this thing up by May 14th. |
Closed in favour of #713 |
I've got an Error
failed to convert to UTF8
when I was getting a page source from my device.It was an WebView, so I think it contained some non UTF8 characters in the page. In order to continue the test, I thought it's better to return some page information rather than raising UTF8 conversion error. Therefore I've created the pull request. Thank you.