var byteArr:ByteArray = new ByteArray(); byteArr.writeMultiByte(mainStr,"utf-8"); mainStr = byteArr.readMultiByte(byteArr.length-1,"utf-8");