 
         protected function saveAsUtf16(str:String):ByteArray {
             var bytes:ByteArray = new ByteArray();
+            bytes.writeByte(0xFF);
+            bytes.writeByte(0xFE);
             for (var i:int = 0; i < str.length; i++) {
                 var code:int = str.charCodeAt(i);
                 if (code < 0XFF) {

            charset = newCharset;
        }

        public function setData(newData:String):void {
            data = newData;
        }
    }

        protected function register():void {
        	ExternalInterface.addCallback('setFileName', setFileName);
        	ExternalInterface.addCallback('setCharset', setCharset);
        	ExternalInterface.addCallback('setStrData', setStrData);
        }

        // set file name
