vfox icon indicating copy to clipboard operation
vfox copied to clipboard

powershell7中无法识别环境变量、且有乱码现象

Open greesBird opened this issue 1 year ago • 2 comments

<-- Please answer these questions before submitting them. Thank you. -->

Version vfox 0.5.3, powershell7

OS Windows11

Question Description 将vfox挂载到powershell7中后,sdk无法识别环境变量,且有乱码现象, 如下图所示 image

取消挂载后,上述现象消失,恢复正常,如下图所示 image

greesBird avatar Jun 09 '24 02:06 greesBird

我之前和你有一样的问题,今天突然发现问题消失了,和你分享下我当时的情况:

我怀疑问题可能和一次修复有关,OutputEncoding被改为UTF8导致的,java8在windows下好像是GBK的,当我是用vfox切换到java17时,乱码问题消失了

于是我使用code $profile用vscode编辑,在末尾添加下面的代码后,java8下问题也消失了

$OutputEncoding = [System.Text.Encoding]::GetEncoding("GBK")
[console]::OutputEncoding = [System.Text.Encoding]::GetEncoding("GBK")
[console]::InputEncoding = [System.Text.Encoding]::GetEncoding("GBK")

但是我不想用GBK

当时经过我的一番折腾,问题还是没有彻底解决,我就搁置了这个问题 今天看到你的反馈时,我尝试了一下,发现问题在我的电脑上已经修复了 image

我回想我的设置,可能时我在环境变量中设置了JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8导致的 image 但是我当时也重启过电脑,记得当时并没有生效 现在好像生效了


刚刚我又验证了一下,我把JAVA_TOOL_OPTIONS去掉后,我的乱码如下图,不确定我的方式对你来说是否可行 image

ieayoio avatar Jun 10 '24 06:06 ieayoio

在环境变量里加了JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8后,乱码问题就消失了

greesBird avatar Jun 10 '24 13:06 greesBird