SaveStrings() gives a textfile with strange charakters

As you can see in the code below, I tried to save an Array to a .txt file (as well I tried it with .json) but couldn't get a result. The console.log gives out the right things but the .txt as well as the .json-file only contain some strange charakters...as seen here: ºw^~)Þ and yes it does not change in size or charakter if using more words. Someone got an idea what is missing or terrible wrong?

         //Save JSON-File

          if ((hit[3] == 1)) {
            var TextFile = ['Farbe','_','FarbeTank','_'];
            //var list = split(TextFile, 'z');

            saveStrings(TextFile, 'test.txt');
            saveStrings(list, 'test2.txt');

            /**
            var JSONObj = {
              "FarbeKarosserie" : {
                Farbname: cSavedColorName_K,
                Farbwerte: cSavedColor_K,
              }
            }
            save(JSONObj, 'engo_File.json', true);
            */            
            /**
            JSONObj= json={};
            json.id=0;
            json.Farbe_Karosserie=cSavedColorName_K;
            json.Farbe_Karosserie=cSavedColorName_T;
            json.name="test";
            */

            hit[3] = 0;
          }
Tagged:

Answers

  • edited May 2016

    Is the syntax supposed to be [] for enclosing an array? In common Processing, an array is enclosed in {}.

    int[] numbers = { 1, 2, 3, 4, 5 };
    String[] number_names = { "one", "two", "three", "four", "five" };
    
  • Thanks for your answer and yes, it is correct.I tried it now just to see if I might be wrong, but unfortunately I was correct.

  • Okey, found out that it is a problem with the editor. Used firefox and it worked as intendet.

Sign In or Register to comment.