7 Replies Latest reply on Aug 17, 2013 6:35 AM by bastieneichenberger

    Problem with UTF filenames on Mac OS X

    František Erben


      I found on really annoying problem. I save UTF encoding filename and load it with function getFiles() back, but the strings are unexpectedly NOT equal on OS X 10.8.


      EnteredManually = new File("~/čas.txt");

      PrepareFile = EnteredManually.open("w");
      EnteredManually.encoding = "UTF-8";

      GetFromFilename = File(Folder("~/").getFiles("*.txt"));

      if (GetFromFilename.name == EnteredManually.name) { alert("Is equal!"); }
      else { alert(GetFromFilename.name); alert(EnteredManually.name);  alert("Is NOT equal!\nBecause:\n"+decodeURI(GetFromFilename)+" != "+decodeURI(EnteredManually)+"\n"+encodeURI(GetFromFilename)+" != "+encodeURI(EnteredManually)); }


      I'm sure that this work without problem on Win with Win paths, but not on Mac.

      The problem might be in Normal Form Decomposed of filename on OS X (see http://svn.apache.org/repos/asf/subversion/trunk/notes/unicode-composition-for-filenames).

      Is any workaround how to deal with this problem and make script platform really independent?


      Thank you