-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Difference in result of cleanupSemantic() function on iOS and Android. #121
Comments
Hi @pradiptilala, The guarantees in this library revolve more around producing a diff that when applied against a source text will produce the output text. To that end many of the separate implementations will produce different but legitimate diffs. If you need to guarantee that the generated diffs are the same you may need to look into using a diffing library focused on that, or you could try to submit a patch to the Java or Objective-C code where they differ. Matching the algorithms should be easier between those two since they both represent strings internally with UTF-16, but having worked in both libraries, I'm not where the differences lie. You might start by reviewing |
Hey @dmsnell , Internally library is using the UTF-8 string not UTF-16. We have also checked line-mode diffs but its not giving the result as expected. We have reviewed this cleanupSemantic() function in both iOS and Android, implementation looks same but we could not find any difference. Request your guidance. |
I was speaking about Java and Objective-C themselves, for instance, a Java
if you verified that those functions operate identically then you'll just want to scan around to the other functions. the point I should have stressed more is that the diffs themselves aren't guaranteed to be identical across the different libraries in this project. the guarantee is that once you apply the diffs to the same source text you will find the same output text, and those diffs generally should be human-readable. you could ask for your application, is it critical that Android and iOS shows the same diffs, the same patches? consider that core tools like if you have to have identical diffs it could be the case that you need to look for a library that guarantees that. I'm not a maintainer here but I don't think producing identical diffs is even a goal of the library, and if it happens to do that, I'm not sure it will stay that way as the library grows over time. hope this helps! |
We have used objective-C code for iOS and Java code for Android from library. We are using same set of function to find the difference of string in Android and iOS.
But for some texts we are getting difference results for cleanupSemantic() function on Android and iOS.
In code first we have used the diff_main() function which returns us list of Diff models. In iOS and Android its returning list of Diff() with length 399.
Second, we have used cleanupSemantic() to get the result list of Diff() models. In iOS, cleanupSemantic() function returns list of Diff() with length 8 whereas in Android same function returns list of Diff() with length 11.
Then we are using the diff_prettyHtml function to get highlighted text. We are using this highlighted html text to load into the WebView.
We have customized diff_prettyHtml function to show inserted text in only green background without underline.
Due to difference in result of cleanupSemantic() function on iOS and Android. We are not able to show same text difference on both iOS and Android devices.
iOS result image:
Android result image:
From above images you can find that last 2 lines in Android is different from that is in iOS.
You can also use previousText and updatedText value that we have posted in below example to replicate the issue.
Code used on Android side is as follows:
We have some of the questions regarding the same:
Please suggest us an solution to overcome this issue as soon as possible.
We are very near to our app release, prompt reply will be very helpful.
Thanks,
The text was updated successfully, but these errors were encountered: