• 为什么 execute(`echo 中文`) 输出中文源码?


    为什么 execute(echo 中文) 输出中文源码?

    
    import win.ui;
    /*DSG{{*/
    var winform = win.form(text="管道演示";right=495;bottom=431;parent=...)
    winform.add(
    btnPing={cls="button";text="findstr";left=24;top=169;right=132;bottom=202;z=1};
    edit={cls="edit";text="bbs";left=224;top=172;right=472;bottom=204;edge=1;z=6};
    editInput={cls="edit";text='www.aardio.com
    www.aardio.cn
    bbs.aardio.com';left=16;top=32;right=480;bottom=167;edge=1;multiline=1;z=2};
    editOutput={cls="richedit";left=16;top=212;right=480;bottom=416;edge=1;hscroll=1;multiline=1;vscroll=1;z=3};
    static={cls="static";text="输入字符串:";left=16;top=8;right=120;bottom=24;transparent=1;z=4};
    static2={cls="static";text="启动参数:";left=136;top=177;right=208;bottom=193;align="right";transparent=1;z=5}
    )
    /*}}*/
    
    winform.btnPing.oncommand = function(id,event){
    
        thread.invoke(
            function(winform){
    
                import process.popen;
                var prcs = process.popen(`node -p "console.log('123中文'); console.log(24); setTimeout(console.log, 3000, 1234)"`); 
    
                //写数据到进程输入流
                prcs.writeClose(winform.editInput.text);
    
                //自进程获取输入数据
                winform.editOutput.text = string.fromto(prcs.read(-1),0,936); // 转换为 936 就不乱码了
    
                prcs.close(); 
    
            },winform
        ) 
    }
    
    winform.editOutput.oncommand = function(id,event){
    
    }
    
    winform.show() 
    win.loopMessage();
    

    execute

    
    import io
    io.open()
    
    import string
    var str = `node -p "console.log('123中文'); console.log(24); setTimeout(console.log, 3000, 1234)"`
    str = string.fromto(str,0,936); // 转换为 936 编码输出中文
    execute(str)
    
    import win
    win.loopMessage()
    
  • 相关阅读:
    参考资料来自 懒兔子 的公众号
    Etcd
    zookeeper 杂记
    十二五
    防火墙
    APScheduler
    docker管理工具protainer
    java学习笔记
    linux学习笔记1
    [POI2007]ZAP-Queries
  • 原文地址:https://www.cnblogs.com/daysme/p/12375392.html
Copyright © 2020-2023  润新知