Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

乱码问题 #49

Open
Super1Windcloud opened this issue Aug 14, 2024 · 10 comments
Open

乱码问题 #49

Super1Windcloud opened this issue Aug 14, 2024 · 10 comments
Labels
bug Something isn't working console Fix Available

Comments

@Super1Windcloud
Copy link

*老哥 , 我猜测commandLine.withCharset(Charset.forName("UTF-8")) 这里字符集配置失效可能是因为你创建命令行使用的是NodeCommandLineUtil的缘故 *

image

@Super1Windcloud
Copy link
Author

可以打个端点看看, 代码生效了没

image

@bluelovers
Copy link
Owner

#4 (comment)

@Super1Windcloud
Copy link
Author

UTF8 早就是IDE默认了,
image
你把这里的判断条件去掉, 全部使用UTF-8打包一下我看看还有没有问题

@Super1Windcloud
Copy link
Author

当然 最好的方式设置对应系统的编码方式

 // 获取系统默认的文件编码
        Charset defaultCharset = Charset.defaultCharset();
        System.out.println("Default Charset: " + defaultCharset.name());
commandLine.withCharset(defaultCharset )

@bluelovers
Copy link
Owner

idea-run-typescript.zip

@Super1Windcloud
Copy link
Author

哈哈哈 ,果然是这样, 设置默认编码之后没问题了, 太感谢您了,
image

@bluelovers
Copy link
Owner

順便說下

系統環境變數裡面增加 NODEJS_CONSOLE_USE_TERMINAL
或者更改 idea 系列裡面的 registry 的 nodejs.console.use.terminal

可以消除圖片裡面這個問題

image

@bluelovers
Copy link
Owner

哈哈哈 ,果然是这样, 设置默认编码之后没问题了, 太感谢您了, image

你在 log 檔內找一下 current commandLine.charset 看出現的是什麼

@Super1Windcloud
Copy link
Author

image

WIndows 系统使用的是GBK, 但是WebStorm 使用的是utf8 , 有点奇怪

@bluelovers
Copy link
Owner

image

WIndows 系统使用的是GBK, 但是WebStorm 使用的是utf8 , 有点奇怪

所以才會需要 #4 (comment)

因為他不是包含所有建立出來的終端跟命令烈都是utf8
如果有用到各種內建 run conf 時就會發現

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working console Fix Available
Projects
None yet
Development

No branches or pull requests

2 participants