Code Monkey home page Code Monkey logo

Comments (19)

RonRadtke avatar RonRadtke commented on July 20, 2024 2

@midhunm-c branch is ready for you.
You can install it via npm install RonRadtke/react-native-blob-util#feature/utf8_fix

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024 2

Yeah you're right - I messed that one up when fixing the import cycles.
Version 0.13.14 should fix it. It's already live.

from react-native-blob-util.

devinm-hrbl avatar devinm-hrbl commented on July 20, 2024 2

Thank you so much @RonRadtke , and great collaboration @midhunm-c!

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024 1

@RonRadtke
this is a portion of the json file which makes problem.

{
    "app/screens/onboarding/onboarding-button-texts/next": "Next",
    "app/screens/contact/send-bulk-email": "إرسال بريد إلكتروني دعائي"
  }

This is added to a json file in android document directory and tried to read using JSONStream. done or fail block not getting called.

If I removed this Arabic text from the json the JSONStream is calling the done block.

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024 1

Glad to hear :)

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024 1

Thank you @RonRadtke !!
Integrated the version 0.13.14 and now it's working fine :)

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

Could you please provide a sample json that is problematic?
Don't need you full translation file, just a few lines that will cause the problem.

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024

@RonRadtke
While reading the json file with Arabic text from application document directory as JSONStream this following exception was throwing

image

I have fixed the issue in this PR, #53
Please review this PR.

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

Thank you for your PR.
My problem is, it is not actually fixing the problem. It's a simple bad aid working for now. But in general there seems to be something off with either the data itself or what happens to the data before it being encoded.
So either there are characters in which are not covered by utf8 or somewhere goes something wrong.
So I'll have a closer look at the problem as soon as I have time for.

Also I don't like to have different handling for the different encodings. If we go for it, it would be better to ignore the encoding errors for all different types of encoding to have a similar behavior all over the code.

from react-native-blob-util.

devinm-hrbl avatar devinm-hrbl commented on July 20, 2024

Hello! I completely understand your comments, in fact I would say the same thing. That being said, is there any chance we can have a beta version with this quick fix until you can fix the actual problem? I'd really rather not fork this repo (yet again) and re-host just to have a temporary fix, and I don't have the time to invest in exploring other avenues for a fix.

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

I pushed your fix on a feature branch. Due to the merge conflict I just copied it quickly.
It's the branch features/arabic_json_fix

So you should be able to install it by running npm install RonRadtke/react-native-blob-util#feature/arabic_json_fix

from react-native-blob-util.

devinm-hrbl avatar devinm-hrbl commented on July 20, 2024

Wonderful! Thank you so much, this is going to save us a lot of trouble!

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

I'm relatively sure I know the cause of the problem now.
Basically there are only two options:

  • Your file contains non-utf8 chars
  • Something in the Lib is broken

I assume your file is fine, otherwise you would most likely have problems in iOS too.
Currently we are splitting the input in chunks of 4096 Bytes, but this doesn't respect the fact that UTF8 uses 1,2 or 3 bytes to encode a single character. So most likely we are cutting a valid character in half and thus you're seeing the error.
I hope I'll have the time to reimplement that part in the next week.

I would like to ask you to test the changes with your file to verify it's working fine - I hope you could help there @devinm-hrbl / @midhunm-c ?
I would come back to you then, as soon as it's implemented.

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024

Thank you very much @RonRadtke !!
Yeah sure, we can definitely test once you implemented the fix.

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

@midhunm-c would it be a problem for you if I bump the minSDK to 19? I think I have a working solution for > APi 19.
That would on the other hand mean, you have to stay on a dev branch till I make the next major release, which I plan for September. (Hopefully I get the android scoped storage working till then)

Don't need to bump the API for this :) So I think you will get a branch to test tomorrow.

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024

Thank you @RonRadtke !!
I have checked from the branch feature/utf8_fix and the language is loading without any exception. 👍

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

@devinm-hrbl I published a new version including the fix.
Please shortly give me hint as soon as you migrated so I can delete the old branch you were using.

from react-native-blob-util.

midhunm-c avatar midhunm-c commented on July 20, 2024

Hi @RonRadtke thank you for the new release :)
I have checked from the new version v0.13.13.
But I am getting an infinite warning in console with this new version in both Android and iOS

Possible Unhandled Promise Rejection (id: 1292): TypeError: undefined is not a function (near '...ReactNativeBlobUtil.config...')
But I remember this warning were not in the last branch you have shared feature/utf8_fix and ![image](https://user-images.githubusercontent.com/87301308/131387786-cb46be7c-fb4c-41fb-9bcc-8c9b3bd4f951.png).

Screenshot:
image

PS:
I got this warning before when I was creating the PR from the forked repo. And I changed the import in polyfill/XMLHttpRequest.js.

Screenshot for ref:
image

from react-native-blob-util.

RonRadtke avatar RonRadtke commented on July 20, 2024

Good - then I close the issue and delete the branch within the next days :)

from react-native-blob-util.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.