Problem with WCX plugin and source file names in Chinese

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Problem with WCX plugin and source file names in Chinese

Post by *taohe »

Hi

I am playing with TotalCommander and learning how to write a wcx plugin for it. I just noticed a problem with a wcx plugin.

The plugin I am writing is for packing files only (no unpacking). So I defined the capability of the plugin as

PK_CAPS_NEW|PK_CAPS_MODIFY|PK_CAPS_OPTIONS

If I choose a source file whose name ends with Chinese words, then press "Alt+F5" to use the plugin. The destination file name provided by TC contains corrupted characters.

But if I defined the plugin's capbility as

PK_CAPS_NEW|PK_CAPS_MODIFY|PK_CAPS_MULTIPLE|PK_CAPS_OPTIONS

There was no probelm. Is this a defined behavior?

In addition, I guess TC has to calculate total size of the selected files before calling wcx plugins, in order to display the progress window correctly. If the calculation is done before calling the plugin's PackFiles method, is it possible to pass the total size to the plugin? This may be useful if the plugin need call thirty command and operates on directory instead of files.

Thanks!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48173
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

When PK_CAPS_MULTIPLE is missing, TC is changing the target name to e.g. *.*.ext for packing to multiple separate archives. Apparently this doesn't work with Chinese names.
Author of Total Commander
https://www.ghisler.com
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Post by *taohe »

Thanks for the reply! I did not notice this forum and I posted my questions in a wrong one, and kept check ing for any response there. Sorry.

Supprisingly, if PK_CAPS_MULTIPLE is missing, and I choose to pack multiple separate archives, this does work with Chinese names. In this case, I use the same name of the source AddList as the target name for each selected source directories.

The problem happens when I only selected one file to use the plugin. The target name suggested by TC contains corrupted characters. Actually, it is not that corrupted. Only ".ext" becomes "?ext", the "dot" becomes "?" in the suggested target file name.

This problem does not occur If I add PK_CAPS_MULTIPLE.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48173
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Does this happen with all Chinese names, or only some? Anyway, I will try to reproduce it (Win2k can be switched to Chinese), and then try to find a workaround.
Author of Total Commander
https://www.ghisler.com
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Post by *taohe »

This only happens with file names ending with any Chinese character.

If the ending character is English one, no problem. Even if the file name contains Chinese words.

Thanks!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48173
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have just tried to reproduce it here, both with a Chinese file name and English extension, and with Chinese name+extension - no problems! Maybe it happens only with certain characters?
Author of Total Commander
https://www.ghisler.com
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Post by *taohe »

Thanks for taking care of this problem.

Firstly, I am sorry that I might have given you wrong information. My plugin operates on directories not files. So the problem is actually with directory names but not file names.

So the problem is if I select a directory whose name's last characters is Chinese (I guess the same problem may happen with Japanese and Korean languages as well), then press "Alt+F5" to use my plugin to pack the selected directory, the target file's name offered by TC for the plugin would contain corrucpted characters.

The problem will be gone if the plugin can do PK_CAPS_MULTIPLE.

I have tested quite throughly and asked my friends to test as well. The problem is quite repeatable. I even don't have to recompile the code, change the configure of the plugin in the wincmd.ini from

Code: Select all

tio=23,F:\totalcmd\plugins\totaliso\TotalISO.wcx
to

Code: Select all

tio=19,F:\totalcmd\plugins\totaliso\TotalISO.wcx
will show the problem.


Please refer to my email to you a few days back regarding how to submit plugins to your addons page. If allowed, I would like to submit the plugin, or if you think ok, I can send the plugin to you via email to test.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48173
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, please send me the plugin by e-mail for testing!
Author of Total Commander
https://www.ghisler.com
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Post by *taohe »

ghisler(Author) wrote:Yes, please send me the plugin by e-mail for testing!
I have sent the plugin to you by email.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48173
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks, I could reproduce and correct the name error.
Author of Total Commander
https://www.ghisler.com
taohe
Junior Member
Junior Member
Posts: 47
Joined: 2004-12-26, 06:57 UTC

Post by *taohe »

ghisler(Author) wrote:Thanks, I could reproduce and correct the name error.
Glad to know that. Thanks!
Post Reply