I am using the following versions.
iOS 16.4
cordova 11.10
cordova-ios 6.3.0
cordova-plugin-file 7.0.0
The Cordova app is able to create a file named Υμνολόγιο2015 using extended characters with the following code:
window.requestFileSystem(
window.PERSISTENT,
0,
function(fileSystem) {
fileSystem.root.getFile(
encodeURI('Υμνολόγιο2015'),
{create: true, exclusive: false},
function(fileEntry) {
fileEntry.createWriter(
function(writer) {
console.log('File created.');
},
function(error) {
console.log('Error creating file. ' + error);
}
);
},
function(error) {
console.log('Unable to get file entry for writing. ' + error);
}
);
},
function(error) {
console.log('Request file system failed. ' + error);
}
);
The iOS file system now contains the file with an encoded file name as follows:
%CE%A5%CE%BC%CE%BD%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF2015
Attempting to read this file using the original file name of Υμνολόγιο2015 results in a file not found error code: 1 which is NOT_FOUND_ERR.
window.requestFileSystem(
window.PERSISTENT,
0,
function(fileSystem) {
fileSystem.root.getFile(
'Υμνολόγιο2015',
null,
function(fileEntry) {
fileEntry.file(
function(file) {
var reader = new FileReader();
reader.onerror = function (event) {
console.log(event);
};
reader.onloadend = function(evt) {
console.log(evt.target.result)
};
reader.readAsText(file);
},
function(error) {
console.log(error)
}
);
},
function(error) {
console.log(error)
}
);
},
function(error) {
console.log(error)
}
);
When I attempt to read the file using the encoded file name I get the following error code: 5 which is ENCODING_ERR. It seems the encoded file name is being encoded again.
window.requestFileSystem(
window.PERSISTENT,
0,
function(fileSystem) {
fileSystem.root.getFile(
'%CE%A5%CE%BC%CE%BD%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF2015',
null,
function(fileEntry) {
fileEntry.file(
function(file) {
var reader = new FileReader();
reader.onerror = function (event) {
console.log(event);
};
reader.onloadend = function(evt) {
console.log(evt.target.result)
};
reader.readAsText(file);
},
function(error) {
console.log(error)
}
);
},
function(error) {
console.log(error)
}
);
},
function(error) {
console.log(error)
}
);
If I do the same thing with a file name using only ASCII characters, writing and reading the file has no issues.
This also only happens on iOS, Android has no issues.
Thanks for your help and time!