Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"File not found" when file path have non-English characters #14

Closed
apolkingg8 opened this issue Nov 25, 2017 · 3 comments
Closed

"File not found" when file path have non-English characters #14

apolkingg8 opened this issue Nov 25, 2017 · 3 comments

Comments

@apolkingg8
Copy link
Contributor

When file path have non-english words, the exifTool.read() throw error like that:

stderr.data: File not found: G:/xxx/xxx/test_images/中文資料夾/2185_hodesti_00_p_1024x768.jpg
@apolkingg8
Copy link
Contributor Author

apolkingg8 commented Nov 25, 2017

I tried to use exiftool-vendored.exe with cmd and it works with some warning:

 exiftool.exe -json -coordFormat -fast G:\xxx\xxx\test_images\中文資料夾\2185_hodesti_00_p_1024x768.jpg
[{
  "SourceFile": "G:/xxx/xxx/test_images/????????/2185_hodesti_00_p_1024x768.jpg",
  "ExifToolVersion": 10.67,
  "FileName": "2185_hodesti_00_p_1024x768.jpg",
  "Directory": "G:/xxx/xxx/test_images/????????",
  "Warning": "FileName encoding not specified",
  "FileSize": "231 kB",
  "FileModifyDate": "2017:11:09 19:13:53+08:00",
  "FileAccessDate": "2017:11:25 19:31:54+08:00",
  "FileCreateDate": "2017:11:25 19:31:54+08:00",
  "FilePermissions": "rw-rw-rw-",
  "FileType": "JPEG",
  "FileTypeExtension": "jpg",
  "MIMEType": "image/jpeg",
  "ExifByteOrder": "Little-endian (Intel, II)",
  "Quality": "50%",
  "XMPToolkit": "Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        ",
  "DocumentID": "xmp.did:52B846D12C5F11E68760B4A2427E585A",
  "InstanceID": "xmp.iid:52B846D02C5F11E68760B4A2427E585A",
  "CreatorTool": "Adobe Photoshop CS6 Windows",
  "DerivedFromInstanceID": "xmp.iid:3B9752392C5B11E68F6E9F730A5AE25D",
  "DerivedFromDocumentID": "xmp.did:3B97523A2C5B11E68F6E9F730A5AE25D",
  "DCTEncodeVersion": 100,
  "APP14Flags0": "[14], Encoded with Blend=1 downsampling",
  "APP14Flags1": "(none)",
  "ColorTransform": "YCbCr",
  "ImageWidth": 1024,
  "ImageHeight": 768,
  "EncodingProcess": "Baseline DCT, Huffman coding",
  "BitsPerSample": 8,
  "ColorComponents": 3,
  "YCbCrSubSampling": "YCbCr4:2:0 (2 2)",
  "ImageSize": "1024x768",
  "Megapixels": 0.786
}]

@apolkingg8 apolkingg8 changed the title "File not found" when file path have non-English words "File not found" when file path have non-English characters Nov 25, 2017
@apolkingg8
Copy link
Contributor Author

apolkingg8 commented Nov 25, 2017

I found an similar issue in another exiftool repo and add "-charset", "filename=utf8", in ReadTask.ts, then it works!

It looks like that:

static for(filename: string, optionalArgs: string[] = []): ReadTask {
    const sourceFile = _path.resolve(filename)
    const args = [
      "-json",
      "-coordFormat", "%.8f", // Just a float, please, not the default of "22 deg 20' 7.58\" N"
      "-fast",
      "-charset", "filename=utf8",
      ...optionalArgs,
      sourceFile
    ]
    return new ReadTask(sourceFile, args)
}

Maybe write will have similar problem. I don't know it's a regular solution or not, please feel free to close my PR if I did something wrong.

BTW, thanks for this cool project, I love strong type so much :)

@mceachen
Copy link
Member

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants