• 您的位置:首页 > 新闻动态 > 技术文章

    vscode安装arduino插件后输出乱码问题

    2023/7/27      点击:

    到下面的目录下找到utils.js文件,转到209行

    C:\Users\Administrator\.vscode\extensions\vsciot-vscode.vscode-arduino-0.6.0-win32-x64\out\src\common


    function spawn(command, args = [], options = {}, output) {
    
        return new Promise((resolve, reject) => {
            options.cwd = options.cwd || path.resolve(path.join(__dirname, ".."));
            const child = child_process.spawn(command, args, options);
            let codepage = "65001";
            /***********************注释这里的编码设置,解决arduino编译输出乱码问题 
             if (os.platform() === "win32") {
              codepage = getArduinoL4jCodepage(command.replace(/.exe$/i, ".l4j.ini"));
                if (!codepage) {
                    try {
                        const chcp = child_process.execSync("chcp.com");
                        codepage = chcp.toString().split(":").pop().trim();
                    }
                    catch (error) {
                        outputChannel_1.arduinoChannel.warning(`Defaulting to code page 850 because chcp.com failed.\
                        \rEnsure your path includes %SystemRoot%\\system32\r${error.message}`);
                        codepage = "850";
                    }
                }
            }*************************/