PDA

View Full Version : 1.11.2.0 New Issue: Cannot Run Script on Path with Chinese



xLeaves
25-01-2020, 22:11
This problem did not exist in previous versions of ThinBasic
I verified that this problem also occurs with thinAir

For example, ThinBasic is installed on the C drive. The default path is C: \ ThinBasic. This is to rename the ThinBasic folder to any Chinese name, and then create a script file with a tbasic suffix. This script file will not run.

ErosOlmi
26-01-2020, 19:22
Do not remember to have changed something in that area.

What exact version were you using before?
So I can check what I changed


... just thinking ...
if you are invoking thinBasic.exe with full path from your application ... it should work.
But if you change thinBasic path after installation ... there could be problem with thinBasic executed from the shell because during installation some registry keys are set:
Here below {app} is the path where you decided to install thinBasic during setup

[Registry]
;install path
Root: HKLM; Subkey: SOFTWARE\ThinBasic; ValueType: string; ValueName: InstallPath; Flags: noerror CreateValueIfDoesntExist DeleteValue; ValueData: {app}\;


;tbasic
Root: HKCR; SubKey: .tBasic; ValueType: string; ValueName: ; ValueData: thinBasic.Script.File; Flags: uninsdeletekey
Root: HKCR; SubKey: thinBasic.Script.File; ValueType: string; ValueName: ; ValueData: thinBasic.Script.File; Flags: uninsdeletekey
Root: HKCR; Subkey: thinBasic.Script.File\DefaultIcon; ValueType: string; ValueName: ; ValueData: "{app}\thinBasic.exe,0"; Flags: uninsdeletekey
Root: HKCR; SubKey: thinBasic.Script.File\shell\Open\command; ValueType: string; ValueData: "{app}\thinBasic.exe ""%1"""; Flags: uninsdeletekey;
Root: HKCR; SubKey: thinBasic.Script.File\shell\Edit\command; ValueType: string; ValueData: "{app}\thinAir\thinAir.exe ""%1"""; Flags: uninsdeletekey;
Root: HKCR; SubKey: thinBasic.Script.File\shell\thinDebug\command; ValueType: string; ValueData: "{app}\thinBasic.exe @D ""%1"""; Flags: uninsdeletekey;

xLeaves
27-01-2020, 23:38
Do not remember to have changed something in that area.

What exact version were you using before?
So I can check what I changed


... just thinking ...
if you are invoking thinBasic.exe with full path from your application ... it should work.
But if you change thinBasic path after installation ... there could be problem with thinBasic executed from the shell because during installation some registry keys are set:
Here below {app} is the path where you decided to install thinBasic during setup

[Registry]
;install path
Root: HKLM; Subkey: SOFTWARE\ThinBasic; ValueType: string; ValueName: InstallPath; Flags: noerror CreateValueIfDoesntExist DeleteValue; ValueData: {app}\;


;tbasic
Root: HKCR; SubKey: .tBasic; ValueType: string; ValueName: ; ValueData: thinBasic.Script.File; Flags: uninsdeletekey
Root: HKCR; SubKey: thinBasic.Script.File; ValueType: string; ValueName: ; ValueData: thinBasic.Script.File; Flags: uninsdeletekey
Root: HKCR; Subkey: thinBasic.Script.File\DefaultIcon; ValueType: string; ValueName: ; ValueData: "{app}\thinBasic.exe,0"; Flags: uninsdeletekey
Root: HKCR; SubKey: thinBasic.Script.File\shell\Open\command; ValueType: string; ValueData: "{app}\thinBasic.exe ""%1"""; Flags: uninsdeletekey;
Root: HKCR; SubKey: thinBasic.Script.File\shell\Edit\command; ValueType: string; ValueData: "{app}\thinAir\thinAir.exe ""%1"""; Flags: uninsdeletekey;
Root: HKCR; SubKey: thinBasic.Script.File\shell\thinDebug\command; ValueType: string; ValueData: "{app}\thinBasic.exe @D ""%1"""; Flags: uninsdeletekey;

Thank you very much, ErosOlmi. I made some attempts and found that my file path was garbled due to encoding problems. After checking the updated document, I found that because the new version uses utf8 in full, I was negligent. Misleading, you can delete this post.

1.11.2.0 is no problem, it works well, and the full switch to UTF-8 is good news

xLeaves
29-01-2020, 02:52
I tested it again completely. It seems that the current support for UTF-8 is not complete.

I set the file encoding to ANSI (GBK) and opened it with ThinAir. The Chinese characters in the file content could not be displayed properly, and running and generating the EXE could not be performed correctly (if the file path is all English, it can be run, but the Chinese characters cannot be displayed).

After that, I changed the file encoding to utf-8, and now it is displayed normally, the file can run, but except for a few extension libraries such as the UI library and file library that support utf-8, most of the libraries must be converted to encoding, and the encoding is changed to utf- Changes to 8 are still in progress, so this is not a problem.

However, when I tried to generate the EXE, I found that when the utf-8 encoded file was parsed, many places could not handle Chinese correctly. For example, the dependent extension library, if the path is Chinese (the easiest way to reproduce is to change the ThinBasic installation directory Into a Chinese directory), it cannot be displayed correctly. If the file #Include contains Chinese, the error will be reported directly.

I do n’t know if you can easily reproduce this problem, or what I can do for you. After all, it ’s not easy to input Chinese characters on an English computer. I ’ll provide some Chinese characters, you can copy the test :中文测试字符



In addition, I am very interested in the UI extension library. Can ErosOlmi use me as one of the maintainers of this library? I have developed Win32SDK-based interface library in FreeBasic: https://gitee.com/xywhsoft/xui

I noticed that this extension library supports controlling the control and triggering events directly through the control name without WndProc. I think this is very friendly to novices, but there is still a lot of room for improvement in this part of the function. Maybe I can contribute a little here power.

ErosOlmi
04-02-2020, 13:01
Thanks a lot for reporting all those details.
Yes UTF-8 is still under heavy update in all modules.
I will see if I can fix some of them and let you work more easily.

Regarding UI module ... actually it is written in un-elegant way not suitable to be published as source code but it can be an idea.
I'm continuing to update it in order to have easy dotted notation that seems a good way to simplify script.

If you check 1.11.3 alpha version and script \thinBasic\SampleScripts\UI\Resources\Resources_Test_001.tbasic you will see some improvements in controls handling.