Jump to content
Sign in to follow this  
Sody

The console window character encoding does not support UTF-8

Recommended Posts

Hi,

I am using Chinese Windows OS, and try to use function process (FProcess) to execute external script. It seems FProcess runs OK, but the Console does not show the error message correctly. It looks like:

*** INFO Process : started ... [D:\\test.bat]

hello world

 

����: ��֧���������¶����������˳��˽��̡�

*** INFO Process : finished [exit code 0]

The codes in feature definition are quite simple.  They are

string exe("D:\\test.bat")
process mytool(exe)
mytool.run()

And the test.bat is also very simple. It is

@echo off
echo hello world

timeout /t 10 /nobreak >nul

The error message shows when the timeout line is executed, which shows like a list of question marks. I guess it is because the Console window does not support utf-8 characters. It would be much easier for me to debug the codes if the Console window could show correct message.

By the way, instead of Software Connector, the reason I use FProcess to get info from external program is that the amount and positions of datas in the input.txt are not fixed. I have tried to use runProcessBlocking to execute the external script, but there is very limited infomation about this function from the documentation. I don't know if there is any example in the tutorials. If you could give some simple examples about runProcessBlocking, it would be very helpful.

Thanks.

Share this post


Link to post
Share on other sites

Hi Sody,

nice to see, that you are trying advanced feature programming.
Your approach is quite nice and working fine. As you wrote correctly the problem is about special characters. CAESES supports utf-8, but executing a .bat script without specific code page will not output utf-8 characters by default. You can change the code page for batch scripts in windows by adding "chcp 65001" to the script. (see https://ss64.com/nt/chcp.html)

btw.: The CAESES Console is primarily for debugging CAESES code (FPL). Its behaviour might differ to knowni terminals. This is mainly the reason, why 'timeout /t...' throws an error.

Regards

Carl

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...