为什么 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\r\nwww.aardio.cn\r\nbbs.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()

?

原文地址:https://www.cnblogs.com/daysme/p/12375392.html

时间: 2024-08-11 16:32:36

为什么 execute(`echo 中文`) 输出中文源码?的相关文章

Log4Qt快速入门——Log4Qt日志输出重定向源码解析

Log4Qt快速入门--Log4Qt日志输出重定向源码解析 一.Appender简介 1.Appender简介 Appender是所有Appender的抽象类,是对记录日志形式的抽象.Log4Qt(Qt4版本)中Appender继承体系如下: 2.Appender接口 virtual Filter *filter() const = 0; virtual QString name() const = 0; virtual Layout *layout() const = 0; virtual b

(转)C#生成中文汉字验证码源码(webform)

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.Ht

Struts2中文乱码问题源码分析___转

前几天在论坛上看到一篇帖子,是关于Struts2.0中文乱码的,楼主采用的是spring的字符编码过滤器 (CharacterEncodingFilter)统一编码为GBK,前台提交表单数据到Action,但是在Action中得到的中文全部是乱码,前 台的页面编码都是GBK没有问题.这是为什么呢?下面我们就通过阅读FilterDispatcher和CharacterEncodingFilter 这两个过滤器的源代码,了解其实现细节,最终得出为什么中文还是乱码! web.xml配置: 1     

【源码分享下载】每日更新之Android项目源码---手机天气预报系统

Android项目源码---手机天气预报系统 服务分类: 其他 使用服务: 其他 功能分类: 生活 支持平台: Android 运行环境: Android 开发语言: Java 开发工具: Eclipse 源码大小: 6.17MB 下载地址:http://www.devstore.cn/code/info/104.html 源码简介 本项目是一个天气预报项目源码,可以设置城市.可以更换应用内背景图片.自带天气widget小组件等,天气信息由m.weather.com.cn提供.比较适合新手学习和

[ASP.NET]分析MVC5源码,并实现一个ASP.MVC

本节内容不是MVC入门教程,主要讲MVC原理,实现一个和ASP.NET MVC类似基本原理的项目. MVC原理是依赖于ASP.NET管道事件基础之上的.对于这块,可阅读上节内容 [ASP.NET]谈谈IIS与ASP.NET管道 本节目录: MVC简介 MVC5源码 实现一个MVC MVC简介 随着技术的发展,现在已经将MVC模式等同于三层模式. 如果要严格区分的话,UI层指View和Controller,BLL,DAL层和模型层都属于Model中. 在建立MVC项目的时候,选择空的项目,会建立一

RedHat6.4系统下LAMP环境的搭建---(源码包编译安装)---

(一)httpd(源码包安装) 安装准备: 1 安装htppd软件所依赖的软件包 yum -y install gcc gcc-c++ pcre pcre-devel apr apr-devel apr-util apr-util-devel zlib zlib-devel openssl openssl-devel 安装完成显示如下: Installed: apr.x86_64 0:1.3.9-5.el6_2 apr-devel.x86_64 0:1.3.9-5.el6_2 apr-util.

MyBatis源码解读

前言 之前我们通过图片讲解了Mybatis底层原理,今天我们就从源码入手去解读下Mybatis这个持久化框架是如何执行SQL的这个完整过程. 老样子,我们在看源码之前先写下demo,参考官方文档进行编写即可.mysql5.7\mybatis1.3.9\springboot项目 mybatisdemo User表的model类 package com.ckmike.mybatisdemo.model; import java.util.Date; /** * User 简要描述 * <p> TO

超赞!推荐一个专注于Java后端源码分析的Github项目!

大家好,最近有小伙伴们建议我把源码分析文章及源码分析项目(带注释版)放到github上,这样小伙伴们就可以把带中文注释的源码项目下载到自己本地电脑,结合源码分析文章自己本地调试,总之对于学习开源项目源码会更方便. 因此下面提供[源码笔记]的Github地址,若您觉得不错,欢迎Star点亮哦: Github主页:https://github.com/yuanmabiji 源码分析文章:https://github.com/yuanmabiji/Java-SourceCode-Blogs Sprin

MyBatis 源码分析——动态代理

MyBatis框架是如何去执行SQL语句?相信不只是你们,笔者也想要知道是如何进行的.相信有上一章的引导大家都知道SqlSession接口的作用.当然默认情况下还是使用DefaultSqlSession类.关于SqlSession接口的用法有很多种.笔者还是比较喜欢用getMapper方法.对于getMapper方法的实现方式.笔者不能下一个定论.笔者只是想表示一下自己的理解而以--动态代理. 笔者把关于getMapper方法的实现方式理解为动态代理.事实上笔者还想说他可以是一个AOP思想的实现