Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SRP_Run_Command with multi-byte command characters
A customer has found a regression that appears to have come about since SRP Utilities v2.1.6 . I've tracked it down a difference in the way SRP_Run_Command() works, and suspect the changes made for "Fixed bug in SRP_Run_Command where output would not go into variable if it was too long"
We're using the ImageMagick DOS programs to create thumbnails. This now fails when processing an image that contains unicode multi-byte characters in the filename. As an example, when processing "F:\media\飞蛾.jpg" via SRP_Run_Command(), the response is an error "convert.exe: unable to open image 'F:\media\飞蛾.jpg': No such file or directory"
A simpler test would be a DOS COPY command. From v2.1.6, the command "COPY F:\Media\æ.jpg C:\TEMP" just returns "The system cannot find the file specified." - whereas before you'd get "1 file(s) copied."
It appears that the multi-byte characters are being interpreted as single-byte?
This still occurs in SRP Utilities version 2.2.0.3 32bit. However 64bit seems ok!
Any chance of a 32bit fix for this OI9? :)
Cheers, M@
We're using the ImageMagick DOS programs to create thumbnails. This now fails when processing an image that contains unicode multi-byte characters in the filename. As an example, when processing "F:\media\飞蛾.jpg" via SRP_Run_Command(), the response is an error "convert.exe: unable to open image 'F:\media\飞蛾.jpg': No such file or directory"
A simpler test would be a DOS COPY command. From v2.1.6, the command "COPY F:\Media\æ.jpg C:\TEMP" just returns "The system cannot find the file specified." - whereas before you'd get "1 file(s) copied."
It appears that the multi-byte characters are being interpreted as single-byte?
This still occurs in SRP Utilities version 2.2.0.3 32bit. However 64bit seems ok!
Any chance of a 32bit fix for this OI9? :)
Cheers, M@
Comments
In testing this I found that it also fixed another quirk in that previous versions (even as far back as v1.6) would return multiple results for the command "dir f:\media\飞蛾.jpg /b", depending on what else was in that directory. It should only return one result, of course.
But curiously, the 64bit version (still at v2.2.0.3) still returns multiple results for this command. Eg,
73.jpg
c.jpg
‘.jpg
??.jpg
This doesn't affect us at the moment, but it's probably worth noting the difference ;).
Cheers, M@
73.jpg
c.jpg
�.jpg
??.jpg
The �.jpg filename is for the 飞蛾.jpg requested.
??.jpg is for æ.jpg
Actually, it doesn't recognise æ.jpg directly:
File Not Found
Works in 32bit !?
Thanks, M@
This is looking even better in 32bit with the correct unicode characters coming back in the output.
The 64bit is still having problems though:
73.jpg
c.jpg
æ.jpg
飞蛾.jpg
Specifically for our case, I'm trying to extract the metadata of an image, eg for æ.jpg I get
identify.exe: UnableToOpenBlob 'F:\media\�.jpg': No such file or directory @ error/blob.c/OpenBlob/2691.
It seems the problem now is with translation to the command line as well? I've tried this again with version 2.2.0.3 and it does recognise the file, even though the characters on output aren't right
Image: F:\media\æ.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 468x813+0+0
Resolution: 300x300
Cheers, M@
Ok, that works for æ.jpg - but 飞蛾.jpg is still being interpreted as multiple files at DOS. If I try to extract the metadata for this image, it gives me the metadata for 73.jpg as well (but not the other two!?). Perhaps there's just something very odd about the encoding of those chinese characters.
And just confirming the 32bit is all ok.
Cheers, M@
Thanks for your time on this :)
Cheers, M@
In 2.2.1.4, 64bit
æ.jpg
_run evalv "c= 'dir F:\media\飞蛾.jpg /b'` @ans = 'VAR'` Call SRP_Run_Command( c, @ans)"
73.jpg
c.jpg
æ.jpg
??.jpg
In 2.2.1.4, 32bit (perfect :)
æ.jpg
.
_run evalv "c= 'dir F:\media\飞蛾.jpg /b'` @ans = 'VAR'` Call SRP_Run_Command( c, @ans)"
飞蛾.jpg
But in 2.2.1.5, 64bit
‘.jpg
_run evalv "c= 'dir F:\media\飞蛾.jpg /b'` @ans = 'VAR'` Call SRP_Run_Command( c, @ans)"
73.jpg
c.jpg
‘.jpg
??.jpg
and 2.2.1.5, 32bit
‘.jpg
.
_run evalv "c= 'dir F:\media\飞蛾.jpg /b'` @ans = 'VAR'` Call SRP_Run_Command( c, @ans)"
??.jpg
Eg, 2.2.1.4 32bit
㔷ㅸ㐱
Using 2.1.6, this returns correctly as '75x114'
If I physically rotate the image 90 degrees, SRP_Run_Command() correctly returns '114x75'
Rotate it again and it comes back as '㔷ㅸ㐱' instead of '75x114'
This return value should just be a simple text string. Why the difference? Could ImageMagick be setting some kind of DOS return code that v2.2.1.5 is sensitive to??
Hope you can help. I've already deployed this and might have to revert back to v2.1.6
Cheers, M@.
Thanks very much Kevin :)