Windows binaries unable to open paths with Unicode characters
Closed this issue · 2 comments
akaleeroy commented
Say I have a file at D:\Config\Desktop\Șmotru\test.jpg
>jpeg-recompress.exe D:\Config\Desktop\Șmotru\test.jpg output.jpg
jpeg-recompress: unable to open file: D:\Config\Desktop\?motru\test.jpg
Ș
gets converted to ?
, breaking the file path
I don't think it's the command prompt since @chcp 65001>nul
does nothing.
zvezdochiot commented
This is not a problem of jpeg-recompress
itself, but of the one with which the assembly was performed.
Try:
type D:\Config\Desktop\Șmotru\test.jpg output.jpg | jpeg-recompress.exe -a - testout.jpg
akaleeroy commented
Good workaround, thanks!
I still don't get why piping in the input works... are you saying it has to do with the executable's compilation?
Anyway, here's the final compression batch file fixed of Unicode path problems:
:: drag-jpeg-to-recompress.cmd
:: Place this script in the same folder as jpeg-recompress.exe
@echo off
set path=%~d0%~p0
:start
type %1 output.jpg 2>nul | "%path%jpeg-recompress.exe" - %~nx1 || (pause && exit /b 1)
shift
if NOT x%1==x goto start