[code]/***************************************************************************************************************/
dim source as new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\Sheet 001.jpeg”, FolderItem.PathTypeNative)
dim dest as new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\??? ???.jpeg”, FolderItem.PathTypeNative)
dim imageMagick as new FolderItem(“C:\Users\Fiera\Desktop\ImageMagick\convert64.exe”, FolderItem.PathTypeNative)
Dim s As Shell
s = New Shell
s.Mode = 0
s.Canonical = true
s.TimeOut = 6000
I use Windows and I want use ImageMagick to convert the image file “Sheet 001.jpeg” in the image file “??? ???.jpeg” and viceversa, the command line for ImageMagick is:
convert64.exe path_input_image path_output_image
My problem is that:
The output file is created correctly but since the name of output file is not ascii the output name is wrong (“יפה יפה.jpeg”), I used the function “Launch” and the class “WindowsShellExecuteMBS”, they work but they are not synchronous and I need to proceed to the next step that the ImageMagick have completed its work.
Let’s take a step back and assume for a second that @Giuseppe Vettigli is a new user, does not know how to move topics on the forum, and tried to follow @Emile Schwarz suggestion to “move” the topic to the Windows channel.
Giuseppe, don’t worry too much about it. And, welcome to the forum. We are usually a very friendly bunch (but not always on Monday morning…)
Shooting in the dark here: I had issues with dos command boxes echoing garbled text when I issued non-ascii character commands. I solved the problem by using /u in the command, to let Windows know to use unicode characters. Perhaps something similar can work for you?
[quote=287641:@Giuseppe Vettigli]The output file is created correctly but since the name of output file is not ascii the output name is wrong (“××¤× ×פ×.jpeg”), I used the function “Launch” and the class “WindowsShellExecuteMBS”, they work but they are not synchronous and I need to proceed to the next step that the ImageMagick have completed its work.
Please, Have You any suggestion?[/quote]
Xojo Shell is encoded in CP1252 (like Windows Command Prompt). It is not able to represent non ASCII characters such as Hebrew.
Instead of trying to have shell create Hebrew characters, use a token name, and rename the file after it has been generated :
[code] dim source as folderItem = new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\Sheet 001.jpeg”, FolderItem.PathTypeNative)
dim dest as new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\token.jpeg”, FolderItem.PathTypeNative)
dim n as string = dest.name
dim imageMagick as new FolderItem(“C:\Users\Fiera\Desktop\ImageMagick\convert64.exe”, FolderItem.PathTypeNative)
Dim s As Shell
s = New Shell
s.Mode = 0
s.Canonical = true
s.TimeOut = 6000
You know, I haven’t thought of this issue for years, but this has been my solution for Windows environments for a while now. Hebrew, Cyrillic, Japanese, Big5, and Korean were driving me nuts until I uncovered that trick.
@Louis Desjardins Thank You very much for the warm welcome! I try ‘/u’ but not work, the shell give me a following message: “/u is a not recognized command”…
@Michel Bujardet Thanks a lot but the problem is that I can have also all input path and all output path in cyrillic…
Then what you must do is copy to a path of your own on input, and copy back to the Cyrillic one on output. So ImageMagick never has to deal with non ascii characters in the shell.
You have to understand that only shell does not deal well with non ASCII. Xojo’s folderItems support UTF-8 and all Cyrillic, Hebrew…
Have you considered writing a batch file in windows that determines the Code page then using sh.execute to run that? It should remember the CHCP command for that session, where sequential shell commands would not.
Off the top of my head, if source was in Cyrillic :
[code]dim source as folderItem = new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\Sheet 001.jpeg”, FolderItem.PathTypeNative)
dim workFolderItem as folderItem = GetTemporaryFolderItem
source.copyfileto(workFolderItem)
dim dest as new FolderItem(“C:\Users\Fiera\Desktop\Esportazione\token.jpeg”, FolderItem.PathTypeNative)
dim n as string = dest.name
dim output as FolderItem = GetTemporaryFolderItem
dim imageMagick as new FolderItem(“C:\Users\Fiera\Desktop\ImageMagick\convert64.exe”, FolderItem.PathTypeNative)
Dim s As Shell
s = New Shell
s.Mode = 0
s.Canonical = true
s.TimeOut = 6000
I have issues with special chars and using the shell on Windows for years (no issues with macOS).
I stumbled on this trick and it is a great workaround.