yermak/AudioBookConverter

Cannot open file with japanese characters in filename

Closed this issue · 6 comments

Hey there, thanks for your great work! Had issue with my m4b file with a filename in japanese. Renamed it to drop japanese characters solved.

ssFunction:31 - app/external/ffprobe.exe -v quiet -print_format json -show_error -show_format -show_streams -show_chapters D:\[7巻] 安達としまむら7.m4b
05-05-2024 15:56:28 ERROR MP4v2ArtWorkChecker:51 - MP4Art Error: ERROR: unable to open for read: D:\[7巻] 安達としまむら7.m4b

05-05-2024 15:56:28 ERROR FFMediaLoader:113 - Failed to load media info
java.lang.NumberFormatException: For input string: "mp4v2::platform::win32::Utf8ToFilename::Utf8DecodeChar:"
	at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at uk.yermak.audiobookconverter.loaders.MP4v2ArtWorkChecker.parseMP4v2ArtList(MP4v2ArtWorkChecker.java:70)
	at uk.yermak.audiobookconverter.loaders.MP4v2ArtWorkChecker.list(MP4v2ArtWorkChecker.java:53)
	at uk.yermak.audiobookconverter.loaders.MediaInfoLoader.call(MediaInfoLoader.java:81)
	at uk.yermak.audiobookconverter.loaders.MediaInfoLoader.call(MediaInfoLoader.java:24)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
05-05-2024 15:56:29 ERROR Book:46 - Error constructing book:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "mp4v2::platform::win32::Utf8ToFilename::Utf8DecodeChar:"
	at uk.yermak.audiobookconverter.loaders.MediaInfoProxy.getMediaInfo(MediaInfoProxy.java:20)
	at uk.yermak.audiobookconverter.loaders.MediaInfoProxy.getBookInfo(MediaInfoProxy.java:80)
	at uk.yermak.audiobookconverter.book.Book.construct(Book.java:33)
	at uk.yermak.audiobookconverter.fx.FilesController.lambda$importChapters$18(FilesController.java:366)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "mp4v2::platform::win32::Utf8ToFilename::Utf8DecodeChar:"
	at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
	at uk.yermak.audiobookconverter.loaders.MediaInfoProxy.getMediaInfo(MediaInfoProxy.java:18)
	... 8 more
Caused by: java.lang.NumberFormatException: For input string: "mp4v2::platform::win32::Utf8ToFilename::Utf8DecodeChar:"
	at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at java.base/java.lang.Integer.parseInt(Unknown Source)
	at uk.yermak.audiobookconverter.loaders.MP4v2ArtWorkChecker.parseMP4v2ArtList(MP4v2ArtWorkChecker.java:70)
	at uk.yermak.audiobookconverter.loaders.MP4v2ArtWorkChecker.list(MP4v2ArtWorkChecker.java:53)
	at uk.yermak.audiobookconverter.loaders.MediaInfoLoader.call(MediaInfoLoader.java:81)
	at uk.yermak.audiobookconverter.loaders.MediaInfoLoader.call(MediaInfoLoader.java:24)
	... 4 more

@txfs19260817, it's very unlikely I will be able to fix it properly. As I'm using as dependancy quite old project mp4v2 which I just compiled and won't be able to fix quickly (or at all).
However, probably, I will be able to workaround it...

Just to clarify: were source filenames in japanese as well? And it was not a problem?
From stack trace - I assume you entered name in japanese and this caused an issue.

Thanks

Hey @yermak thanks for following up!

It's the very first step where I chose a source m4b file with a Japanese name to load. Then, the UI showed nothing and functions other than "Clear" didn't work. Meanwhile I found the error messages in logs. So I suspect it's due to m4b file's Japanese name, because I renamed it in alphanumerics then the software became fully functional.

Thanks, understood.
Correct fix should be in external program mp4v2, but I'm not sure that I could do this.
Alternative workaround, i.e. internal coping book into temp file containing latin only characters could be not optimal for 99% of users...

Do you know if this issue with all Japanese files or just with some of them, I would normally suspect those files where each symbol uses 3 bytes in utf-8, which not uncommon for Japanese hieroglyphs.

Are you on Windows 11?
I apparently have same issuew with m4b books loading with non-Japanese symbols.
Which previously worked...
I will investigate it further...

To fix try following:
Windows Settings -> Time&Language->Language&Region->Admistrative language settings->Language for non-Unicode programs: Change System locale...-> Beta: use Unicode UTF-8 for worldwide language support -> Tick the checkbox.
It will require to reoboot, do it and try agian.

yep it works!