Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-17115

[AIR] Saving file with non-english characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • Adobe Flex SDK 3.3 (Release)
    • None
    • None
    • Affected OS(s): Linux
      Affected OS(s):
      Language Found: Portuguese, Brazilian

    Description

      OS: Fedora 10

      Steps to reproduce:
      1. Create a new WindowedApplication
      2. Add the following code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Script>
      <![CDATA[

      private function saveFile1 () : void

      { var fs : FileStream = new FileStream(); var f : File = File.desktopDirectory.resolvePath("test1.dat"); var bytes : ByteArray = new ByteArray(); var str : String = "non english charachers áéíóúç"; bytes.writeMultiByte( str, "windows-1252" ); for ( var i : int = 0; i < 255; i++ ) bytes.writeUnsignedInt( i ); fs.open ( f, FileMode.WRITE ); fs.writeBytes( bytes ); fs.close(); }

      private function saveFile2 () : void

      { var fs : FileStream = new FileStream(); var f : File = File.desktopDirectory.resolvePath("test2.dat"); var bytes : ByteArray = new ByteArray(); var str : String = "non english charachers áéíóúç"; for ( var i : int = 0; i < 255; i++ ) bytes.writeUnsignedInt( i ); fs.open ( f, FileMode.WRITE ); fs.writeMultiByte( str, "utf-8" ); fs.writeBytes( bytes ); fs.close(); }

      // This is the only way that works, but I can't write non printable characters
      private function saveFile3 () : void

      { var fs : FileStream = new FileStream(); var f : File = File.desktopDirectory.resolvePath("test3.dat"); var bytes : ByteArray = new ByteArray(); var str : String = "non english charachers áéíóúç"; for ( var i : int = 0; i < 255; i++ ) bytes.writeUnsignedInt( i ); fs.open ( f, FileMode.WRITE ); fs.writeMultiByte ( str, "utf-8" ); fs.close(); }

      private function saveFile4 () : void

      { var fs : FileStream = new FileStream(); var f : File = File.desktopDirectory.resolvePath("test4.dat"); var bytes : ByteArray = new ByteArray(); var str : String = "non english charachers áéíóúç"; for ( var i : int = 0; i < 255; i++ ) bytes.writeUnsignedInt( i ); fs.open ( f, FileMode.WRITE ); fs.writeMultiByte ( str, "utf-8" ); fs.close(); fs.open ( f, FileMode.APPEND ); fs.writeBytes( bytes ); fs.close(); }

      ]]
      >
      </mx:Script>

      <mx:Button label="Save File ( Method 1 )" top="00" click="saveFile1()"/>
      <mx:Button label="Save File ( Method 2 )" top="50" click="saveFile2()"/>
      <mx:Button label="Save File ( Method 3 )" top="100" click="saveFile3()"/>
      <mx:Button label="Save File ( Method 4 )" top="150" click="saveFile4()"/>

      </mx:WindowedApplication>

      3.

      Actual Results:
      see attached files ( test1.dat, test2.dat, test3.dat, test4.dat )

      Expected Results:
      see attached file ( result.dat )

      Workaround (if any):
      None

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: