/*
 ** 2013 July 01
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.unity.cli.extract;

import info.ata4.unity.serdes.UnityObject;
import java.io.IOException;

/**
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class TextAssetHandler extends AssetExtractHandler {
    
    public TextAssetHandler(String ext) {
        setOutputFileExtension(ext);
    }

    @Override
    public void extract(UnityObject obj) throws IOException {
        String name = obj.getValue("m_Name");
        String script = obj.getValue("m_Script");
        
        setOutputFileName(name);
        writeData(script.getBytes("UTF8"));
    }
}

/*
 ** 2013 July 01
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.unity.cli.extract;

import info.ata4.unity.serdes.UnityObject;
import info.ata4.unity.serdes.UnityString;
import java.io.IOException;

/**
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class TextAssetHandler extends AssetExtractHandler {
    
    public TextAssetHandler(String ext) {
        setOutputFileExtension(ext);
    }

    @Override
    public void extract(UnityObject obj) throws IOException {
        String name = obj.getValue("m_Name");
        UnityString script = obj.getValue("m_Script", false);
        
        setOutputFileName(name);
        writeData(script.getRaw());
    }
}

Write strings directly and don't convert them to UTF-8
Write strings directly and don't convert them to UTF-8