I have a use-case where the project name contains encoded characters food&good.
In my config.xml, the & is encoded as & -> <name>food&good</name>
Cordova handles this name and decode &. Everything works fine on Xcode, I can build the project.
When this plugin is added, the prepare process return an error:
Executing script found in plugin cordova-plugin-localization-strings for hook "after_prepare": plugins/cordova-plugin-localization-strings/scripts/create_strings.js
Error: Cannot read property 'project' of undefined
I search the root cause and it seems the plugin is trying to find the project at path /food&good/ and does not find it. It is expected as the project path is food&good. The function getProjectName does not decoded encoded characters.
To reproduce
start a new Cordova project cordova create hello com.example.hello "Hello&World"
Hello 👋 Thanks for this plugin.
I have a use-case where the project name contains encoded characters
food&good
.In my config.xml, the
&
is encoded as&
-><name>food&good</name>
Cordova handles this name and decode
&
. Everything works fine on Xcode, I can build the project.When this plugin is added, the prepare process return an error:
I search the root cause and it seems the plugin is trying to find the project at path
/food&good/
and does not find it. It is expected as the project path isfood&good
. The functiongetProjectName
does not decoded encoded characters.To reproduce
cordova create hello com.example.hello "Hello&World"
cd hello
cordova platform add ios
cordova prepare ios
cordova plugin add cordova-plugin-localization-strings
cordova prepare ios
Quick and dirty fix
For my case, I change the file
scripts/create_ios_strings.js
Not dirty fix
I tried to find how cordova decode the project name, but I did not find it. It seems
he
lib can do this, but it adds a dependency (https://www.npmjs.com/package/he#hedecodehtml-options)