Skip to content
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

JEX export corrupts notes on Joplin for Android #9069

Closed
mrjo118 opened this issue Oct 16, 2023 · 4 comments · Fixed by #9076
Closed

JEX export corrupts notes on Joplin for Android #9069

mrjo118 opened this issue Oct 16, 2023 · 4 comments · Fixed by #9076
Assignees
Labels
bug It's a bug high High priority issues mobile All mobile platforms

Comments

@mrjo118
Copy link

mrjo118 commented Oct 16, 2023

I've just corrupted my entire note collection (includes a good few hundred notes migrated from Evernote) after making the mistake of relying only on JEX backups and starting a fresh profile on Joplin based on the JEX import. Unfortunately all my backups were made using the Android app and I had only tested the JEX backup of the desktop app for initially deciding to migrate to Joplin and I didn't keep those backups. Doing a file search there's over 4000 hits which I now need to manually replace the characters with by making my best guess what they originally were.

The issue is that JEX backups on the Android app do not correctly store non standard characters and simply replace them with the ? character.

Environment

Joplin version: 2.12.2
Platform: Android
OS specifics: Using Android 10

Steps to reproduce

  1. On a blank profile, create a new note which includes pound signs (£) and foreign characters such as é
  2. Use the export JEX file facility on the Android app
  3. Inspect the contents of the JEX file. Non standard characters and some symbols (and white-space characters) such as pound sounds have been replaced with the ? character

Describe what you expected to happen

Non standard characters should be retained in their original form, as is the case with the desktop app on Windows

Logfile

N/A

@mrjo118 mrjo118 added the bug It's a bug label Oct 16, 2023
@laurent22 laurent22 added high High priority issues mobile All mobile platforms labels Oct 16, 2023
@personalizedrefrigerator
Copy link
Collaborator

personalizedrefrigerator commented Oct 16, 2023

I can confirm this.

This seems to only affect JEX exports made on Android, however — unicode characters in iOS exports work as expected. As such, I suspect it's related to how we're using React Native FS (the tar-stream library is JavaScript, so should behave the same way on both platforms).

@personalizedrefrigerator
Copy link
Collaborator

personalizedrefrigerator commented Oct 16, 2023

This seems to be an issue with RNFetchBlob.fs.writeFile when given a utf-8 encoding.

For example,

const originalText = 'Test. 🕳️';
await fsDriver.writeFile(filePath, originalText, 'utf-8');

results in

Test. ???

written to filePath.

Here's where we're using RNFetchBlob.fs.writeFile:

return RNFetchBlob.fs.writeFile(path, content, encoding);

Interestingly, I'm not seeing this issue reported upstream in RNFetchBlob (search results and query) or in its possibly more-up-to-date fork.

We should be able to work around this by base64-encoding utf-8 data before sending to RNFetchBlob.fs.writeFile.

Work on a fix for this (that needs to be cleaned up) can be found here https://github.com/personalizedrefrigerator/joplin/tree/pr/fix-tar-create

@mrjo118
Copy link
Author

mrjo118 commented Nov 12, 2023

Thanks for the quick fix on this. I have since managed to correct all my notes. Just wondering what will determine when this code fix will be released to the Play store?

@mrjo118
Copy link
Author

mrjo118 commented Nov 16, 2023

Also, the Android changelog page seems to be broken:
https://joplinapp.org/changelog_android/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment