twinstar6980 / Twinning

https://github.com/twinstar6980/Twinning.Documentation
GNU General Public License v3.0
59 stars 12 forks source link

Issue reading UTF8 String on Windows #24

Closed Haruma-VN closed 9 months ago

Haruma-VN commented 9 months ago

I used a script to obtain list of file, (using KernelX.FileSystem.list_file) Result is two file starts name with Chinese characters break toolkit (I used Console.success(e, []) to print the file name). Below is the output: 0cf9254b-ff49-41c7-9f79-53d1a594c70d.png

Actual:

426308125_903067254651055_5577970099944017666_n.png

By the way, I'm using Kernel: 62, Script: 103 and ShellCli: 35

Haruma-VN commented 9 months ago

Below is the JS if you want to test yourself, you will need to edit the path yourself to test test.zip

twinstar6980 commented 9 months ago

no error on my device. image

Haruma-VN commented 9 months ago

Do I need to edit any Windows specific setting to make toolkit read like your? It seemed that it is the problem from my device.

twinstar6980 commented 9 months ago

I don't know that both kernel and shellcli use unicode, it seems that this problem should not occur ... Is there an error in the environment of shellgui and helper?

Haruma-VN commented 9 months ago

I have tried the ShellGUI and Helper, they worked fine. Only ShellCli occur this issue on my machine.

twinstar6980 commented 9 months ago

Will this error occur when the language of the toolkit is changed to Chinese?

Haruma-VN commented 9 months ago

This error still occur in ShellCLI even when change the language to Chinese. By the way, the output of Chinese string in los still normal.

twinstar6980 commented 9 months ago

try this test: Kernel\kernel\utility\file_system\file_system.hpp:315

for (auto & entry : std::filesystem::directory_iterator{make_std_path(target)}) {
    auto name = make_string(self_cast<std::string>(entry.path().filename().generic_u8string()));
    M_log(mss(Range::accumulate(name, [](auto & e) { return "{:02X} "_sf(e); }, ""_s))); // insert this line

then, call KernelX.FileSystem.list, view the byte data in the output window.

Haruma-VN commented 9 months ago

For some reason when messing with the settings.json, my terminal turned back to normal and the Kernel became fine when obtaining path (very strange). But it is not caused from the toolkit, so i will probably close this issue as completed.

Messenger_creation_9caf786d-71fd-4997-b6de-b0a0be65bd49.jpeg