Open polfdz opened 6 years ago
Since there's no official solution, I'm using a function to remove all "special" characters from filename. There's also a problem with the file name lenght, that's why it gets only the first 100 characters.
function parseFilename(originalString) {
var parsed = originalString.substring(0, 100);
var specialChars = {
a: /[\xE0-\xE6]/g,
A: /[\xC0-\xC6]/g,
e: /[\xE8-\xEB]/g,
E: /[\xC8-\xCB]/g,
i: /[\xEC-\xEF]/g,
I: /[\xCC-\xCF]/g,
o: /[\xF2-\xF6]/g,
O: /[\xD2-\xD6]/g,
u: /[\xF9-\xFC]/g,
U: /[\xD9-\xDC]/g,
c: /\xE7/g,
C: /\xC7/g,
n: /\xF1/g,
N: /\xD1/g,
_: /[^A-Za-z0-9.]/g
};
for (var char in specialChars) {
var regEx = specialChars[char];
parsed = parsed.replace(regEx, char);
}
return parsed;
}
@polfdz i believe this was fixed in 2.2.0
. Can you confirm the issue is resolved for you in this version?
the problem still exists ... file with Greek chars throws {status: 9, message: "File not found"}
yes looks like this issue still exists as all non ASCII characters seem to throw this error. I'm going to close https://github.com/pwlin/cordova-plugin-file-opener2/issues/252 as a duplicate and perhaps pin this issue for now as it seems to be one of the more significant bugs in this plugin.
Can this be an encoding issue with how Java or Objective-C works? Because this plugin does not do anything special.
The way fileName
has been constructed must be wrong because the immediate line check for the existence of the file.
If you look back in the git history, you'll see that this has been changed through merging pull requests.
Does Java's File
object accept an encoding type?
I have the same problem with german characters ß, ä, ö and ü.
The plugin fails when trying to open a file with an accent like tèst.pdf, however if I rename it to test.pdf it opens.
The error thrown is:
{status: 9, message: "File not found"}
Is there any solution?Thanks in advance