File reader not recognizing certain file extensions

ibgang

Member
I have a few UTF-8 encoded text files saved on my Android phone. However, those files cannot be found with Pleco's (version 3.2.82) built-in file manager. However, changing the file extension, Pleco can recognize and correctly open the text files. Below are some extensions I have tested:

File extensions Pleco recognizes:
  • jpg
  • png
  • bmp
  • gif
File extensions Pleco doesn't recognize:
  • txt
  • rtf
  • doc
  • docx
  • pdf
  • html
Removing Chinese characters from the filename does not appear to solve the issue either.

Having to change the filename is a small inconvenience in return for the great functionality this app brings, but hopefully this bug can be addressed?
 

mikelove

皇帝
Staff member
What version of Android is this? And what brand of phone? Also, are you sure you're opening these with File Reader rather than Still image OCR? (do you actually own our Document Reader add-on?)

Also, you say you're using Pleco's 'built-in file manager' - do you mean that you checked the box to have Pleco show its own file chooser UI instead of using the system one? That doesn't work reliably on newer versions of Android (and in fact we've deactivated it on most of them, but some manufacturers might have blocked them in an earlier version of Android than the one Google officially did).

If this is still the system file picker, I'm afraid we don't actually have any control over that one - we tell Android what kinds of files we want and it takes care of showing a UI to pick them - but we can try to reproduce that problem to see if there's an sort of a workaround possible.
 

ibgang

Member
I'm on the Oneplus 7T running a custom ROM (Xtended) on Android 11.

I'm sure I'm using the File Reader and I own the add-on, as when I rename the extension to one of the recognized ones, Pleco recognizes the file and I can open the file just like a text document.

I'm accessing the file manager through Pleco Sidebar > File Reader > Open New File, which brings me to the file manager shown in the attached screenshot. I can't find an option in the settings to check for Pleco to show its own file chooser UI, so perhaps it has been deactivated on my device.
 

Attachments

mikelove

皇帝
Staff member
That screen should not be able to appear on an Android version greater than 10 - are you certain this is really Android 11? Is there maybe a ROM customization tweak of some kind designed to make apps think that you're running an older version of Android so that you can access features that were disabled in newer ones (like Clipboard Monitor)? What does the build signature look like in Pleco (if for example you choose the in-app option to contact support)?

If there's some sort of bug / tweak in this custom firmware that's causing your system version to be mis-reported then I'm afraid all I can suggest is that you try a different firmware.
 

ibgang

Member
I can confirm this is definitely Android 11. I have not seen a setting in the ROM that would spoof Android version, but it certainly does not rule out the possibility.

As for 'Clipboard Monitor', the closest options I can find are the 'Clip Reader' in the sidebar and an option in settings to 'Search clipboard on startup'.

Under sidebar > Contact Us > Customer Support, I get redirected to my email client with the following information filled out: "Pleco Version: Version 3.2.82 (Google Play)" as well as "Registration ID" and "Device Fingerprint" which I don't think should be posted publicly. In the "About Pleco" section, it states "Built on May 18, 2021".

I understand this may be a ROM issue instead of a Pleco issue. Thank you for your help.
 

mikelove

皇帝
Staff member
Could you email or DM your device fingerprint to me? (It’s actually not *that* sensitive - it shouldn’t contain any unique identifiers, just build versions + hardware model info - but I know some people are uncomfortable with posting it)
 

mikelove

皇帝
Staff member
DM received, thanks. It actually seems like the ROM is presenting this as a Google rather than a OnePlus phone, which is definitely odd.

By any chance do you see a 'force legacy file chooser' option turned on in Settings / Miscellaneous? Turn it off if so. If that option doesn't appear, try backing up your Pleco settings, resetting them to defaults, then terminating + reopening Pleco - does that get you to the system file manager instead of ours
 

ibgang

Member
Unfortunately, I can't find that option, neither before nor after resetting settings to defaults.

However, it appears I can open the text file if I do so from my file manager instead of from Pleco. I'm using Amaze File Manager, and when I select the file > Open With > Pleco Reader, the file opens normally.

However, there's a catch. If I close Pleco then go into "Open recent files", the files with recognized extensions as mentioned in the first post are shown correctly, whilst all other files are shown as (file name not readable). When I click on one of the latter files, I get the error:

Sorry, this file could not be opened. Permission Denial: opening provider androidx.core.content.FileProvider from ProcessRecord{e874d6613747:com.pleco.chinesesystem/u0a268} (pid=13747, uid=10268) that is not exported from UID 10213

So it appears that Pleco is missing some sort of permission that Amaze file manager has?

One thing that struck me as weird was all the image file extensions were recognized while others weren't. Perhaps the file reader is erroneously requesting image files from Android as if it was the OCR reader?
 

mikelove

皇帝
Staff member
So it appears that Pleco is missing some sort of permission that Amaze file manager has?
That's possible, yeah - we don't request (nor are we allowed to request, at least not for the version of our app on Google Play) the sort of wide-ranging file read permissions that file manager apps get. It's just kind of befuddling that you're ending up on that screen, which should literally never be reachable on Android 11.

For the images, honestly it seems more likely that whatever weird take on a file permissions system is running on this phone lets files with common image file extensions pass through but not other files. (e.g. because breaking image file permissions would screw up photo sharing)

But frankly the Android file permissions system is such a mess that if you have a partially-working solution now using file extensions despite this wonky custom ROM setup I'd count that as a victory - attempting to get things working better might actually make them worse.

(longer-term our plan with Pleco on Android is to stop accessing external files directly at all and do everything through a sandbox directory + built-in file manager with files merely 'imported' from an external source, as we do on iOS - less convenient for users, but Google seems hell-bent on making it impossible to open files on Android like you can on a normal computer)
 
Top