pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 584 forks source link

When opening pdf file in ios back button is written with chinese characters #250

Closed georgegoudie closed 5 years ago

georgegoudie commented 5 years ago

Using latest version, chinese characters being displayed in ios, phone langauge is set to English img-5523

shnist commented 5 years ago

hi @georgegoudie, thanks for reporting this. I will take a look.

shnist commented 5 years ago

can you please send me a link to the PDF you are downloading and opening through this plugin? My gut tells me that this is not an issue with this plugin because it just hands off to the relevant native application (i.e. this plugin does not control the display of the PDF viewer on iOS), but I would like to double check if I can replicate what you're seeing.

georgegoudie commented 5 years ago

Thanks for getting back to me, here is the pdf. I have noticed it on another pdf which suggests it isn't the pdf but definitely worth checking Green-guide-lakes.pdf

shnist commented 5 years ago

Unfortunately I can't replicate this. The done button appears in English on my local iOS simulator.

screenshot 2019-02-20 at 16 17 50

Are you able to provide a cope snippet of what you're doing?

georgegoudie commented 5 years ago

No problem;

fileTransfer.download(url, this.file.dataDirectory + file.Url).then((entry) => { this.fileOpener.open(this.file.dataDirectory + file.Url, file.MimeType) .then(() => console.log('File is opened')) .catch(e => this.showToast('Could not open file')); }, (error) => { this.showToast('Could not download file, check your internet connection') });

georgegoudie commented 5 years ago

Hi @shnist did you have any luck with this?

shnist commented 5 years ago

hi @georgegoudie, unfortunately I couldn't replicate this, but one thing i've noticed is that you're not using the file entry that is being downloaded? You could try something like this:

fileTransfer.download(url, this.file.dataDirectory + file.Url).then((entry) => {
    this.fileOpener.open(entry.toUrl(), 'application/pdf')
        .then(() => console.log('File is opened'))
        .catch(e => this.showToast('Could not open file'));
}, (error) => {
    this.showToast('Could not download file, check your internet connection')
});

I've assumed that you're only downloading pdfs, so I've hardcoded the MIMETYPE.

georgegoudie commented 5 years ago

This was the culprit! https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2116

Thanks for looking into it for me

shnist commented 5 years ago

what an odd bug! thanks for letting me know the reason.