* try fix the OSX / libmediainfo issues with accented characters. Using NFD is start but doesn't seem to work.

@see http://www.filebot.net/forums/viewtopic.php?f=8&t=766
This commit is contained in:
Reinhard Pointner 2013-06-24 09:23:14 +00:00
parent 10f314ff7c
commit 2eb8e84d59
1 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,8 @@ package net.sourceforge.filebot.mediainfo;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.LinkedHashMap;
@ -46,7 +48,15 @@ public class MediaInfo implements Closeable {
public synchronized boolean open(File file) {
return file.isFile() && MediaInfoLibrary.INSTANCE.Open(handle, new WString(file.getAbsolutePath())) > 0;
if (!file.isFile())
return false;
// MacOS filesystem may require NFD unicode decomposition (forcing NFD seems to work for System.out() but passing to libmediainfo is still not working)
String path = file.getAbsolutePath();
if (Platform.isMac()) {
path = Normalizer.normalize(path, Form.NFD);
}
return MediaInfoLibrary.INSTANCE.Open(handle, new WString(path)) > 0;
}