Search code examples
node.jswindowscordovawindows-10-universalplatform

Cordova windows 10 build fails validation (no UTF8 files)


When a windows cordova platform is added using: cordova platform add windows

And the windows 10 project, inside visual studio 2015, is used to build the app package, the package validation fails, when it's validated using the "Windows App Certification Kit 10.0". The selected architectures are: x86 (release), x64(release) and ARM (release).

UTF-8 file encoding Error Found: The UTF-8 file encoding test detected the following errors:

File C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\cordova_plugins>.js is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte >Order Mark). File C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\cordova-js->src\exec.js is not properly UTF-8 encoded. Re-save the file as UTF-8 (including >Byte Order Mark). File C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\cordova-js->src\platform.js is not properly UTF-8 encoded. Re-save the file as UTF-8 >(including Byte Order Mark). ... File C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\index.html is >not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order >Mark).

Impact if not fixed: HTML, CSS, and JavaScript files must be encoded in UTF-8 >form with a corresponding byte-order mark (BOM) in order to benefit from >bytecode caching and to avoid other runtime error conditions. Bytecode generation Error Found: The bytecode generation test detected the following errors:

File \?\C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\plugins\cordo>va-plugin-splashscreen\www\windows\SplashScreenProxy.js has JavaScript syntax >or other problems. File \?\C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\plugins\cordo>va-plugin-splashscreen\www\splashscreen.js has JavaScript syntax or other >problems. File \?\C:\Program >Files\WindowsApps\BECC1407.AppXPTO_1.4.0.0_x64__6hmvhj7j5fc1t\www\js\app.min.js >has JavaScript syntax or other problems. ... Impact if not fixed: As a performance optimization to accelerate JavaScript >execution time, JavaScript files ending in the ".js" extension generate >bytecode when the app is deployed. This optimization significantly improves >start-up and ongoing execution times for JavaScript. How to fix: You may need consider one or more of these steps to fix the issue: - Avoid deploying the app by pressing F5 in Visual Studio, create an appx >package instead - Ensure that event logging is enabled - All JavaScript files are syntactically valid; otherwise exclude the >respective files from the package - Please note that you should uninstall all previous versions of the app >before deploying Otherwise exclude the respective files from the package.

I tried to submit but the apps fails.

Should not the cordova generate the project ready for publication?

Should I create a hook/nodejs file to rewrite all the files in utf8?


Solution

  • cordova build
    

    does the trick on windows

    cordova prepare changed it's behaviour since January 2016 - adding the BOM attribute now only takes place in the build step instead of the prepare step.

    background:

    --> the BOM gets added using the 'cordova build' command

    see as well: https://issues.apache.org/jira/browse/CB-11241?focusedCommentId=15288933&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15288933