Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-5477

cordova CLI can't create WP8 project with encode issue!

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Abandoned
    • Affects Version/s: None
    • Fix Version/s: 3.5.0
    • Labels:
      None
    • Environment:

      win8(simple chinese)+vs2012+wp8sdk

      Description

      descrip:
      C:\Windows\system32>cordova -v
      3.2.0-0.1.0

      cordova create hello com.example.hello HelloWorld
      cd hello
      cordova platform add wp8

      got errors:

      D:\VSProject\helloCordova>cordova platform add wp8
      Checking wp8 requirements...
      Creating wp8 project...
      [Error: Non-whitespace before first tag.
      Line: 0
      Column: 1
      Char: �]

      Finally I found following files
      wmappmanifest.xml, HelloCordova.csproj, HelloCordova.sln, MainPage.xaml.cs, etc
      were corrupt, the start characters of file content were sth like
      锘?*
      the cli can't parse these files
      I think it's an encoding issue

      here is sample issue https://issues.apache.org/jira/browse/CB-4618

      my opinion:
      i check the corodova cli source code, i found it's this file ".cordova\lib\wp\cordova\3.2.0\wp8\bin\create.js" caused this error!

      in create.js file:

      function write(filename, contents) {
      var f=fso.OpenTextFile(filename, ForWriting, TristateTrue);
      f.Write(contents);
      f.Close();
      }
      WScript OpenTextFile Method : http://msdn.microsoft.com/en-us/library/314cz14s(v=vs.84).aspx
      OpenTextFile Method have 4 args but
      fso.OpenTextFile miss a args create,

      OpenTextFile should open file with "unicode" encode,because cordova wp8 cli template project files are encode with "utf-8". if we not specified encode OpenTextFile should use system default encode ascii.

      cordova template files were encoded with utf8, opentext and wirte with ascii, then save thems will cause encode issue!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                purplecabbage Jesse MacFadyen
                Reporter:
                puchen puchen
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: