Avdump2 on Linux: Difference between revisions

Added UTF-8 locale check to the example script
(Added error explanation for incorrect file name encoding)
(Added UTF-8 locale check to the example script)
Line 33: Line 33:


If you modified ''any'' of the required files Avdump2 came with, you will either get a version error or several timeouts and no meaningful error message. So no, you can’t edit the config file either.
If you modified ''any'' of the required files Avdump2 came with, you will either get a version error or several timeouts and no meaningful error message. So no, you can’t edit the config file either.


'''Failed to create MediaInfoProvider'''
'''Failed to create MediaInfoProvider'''
Line 41: Line 40:
<tt>Invalid value returned by mil. This error may indicate that your LANG or LC_ALL environment variables are not set to use UTF-8 encoding.</tt>
<tt>Invalid value returned by mil. This error may indicate that your LANG or LC_ALL environment variables are not set to use UTF-8 encoding.</tt>


This error appears if you try to process a file with special characters in its name and your locale settings don’t match the file system encoding. Nowadays almost all file names are encoded with UTF-8 on Linux, so your locale should use that as well. If you work remotely on a server that sets LANG to “C” by default, it won’t work. Try setting LC_ALL=en_US.UTF-8, because that locale is installed almost everywhere by default. LC_ALL takes precedence over LANG.
This error appears if you try to process a file with special characters in its name and your locale settings don’t match the file system encoding. Nowadays almost all file names are encoded with UTF-8 on Linux, so your locale should use that as well. If you work remotely on a server that sets LANG to “C” by default, it won’t work. Try setting LC_ALL=en_US.UTF-8, because that locale is installed almost everywhere by default. LC_ALL takes precedence over LANG. Have a look at the example script below to see how to make the setting automatically.


If you have a file with bogus characters in its name, even changing the locale won’t help. You have to rename the file to something sensible.
If you have a file with bogus characters in its name, even changing the locale won’t help. You have to rename the file to something sensible.
Line 57: Line 56:
To make using Avdump2 more comfortable, you can use or modify this wrapper script to handle the workarounds. Save it as <tt>/usr/local/bin/avdump2cl</tt>, for example. This example assumes that you extracted Avdump2 to <tt>/usr/local/lib/avdump2</tt>.
To make using Avdump2 more comfortable, you can use or modify this wrapper script to handle the workarounds. Save it as <tt>/usr/local/bin/avdump2cl</tt>, for example. This example assumes that you extracted Avdump2 to <tt>/usr/local/lib/avdump2</tt>.


A simple wrapper to set the <tt>LD_LIBRARY_PATH</tt> and to fix the cursor after using ^C:
A simple wrapper to set the <tt>LD_LIBRARY_PATH</tt>, check the locale for UTF-8 and to fix the cursor after using ^C:
<pre>
<pre>
#!/bin/bash
#!/bin/bash
Line 67: Line 66:
# If libMediaInfo still can't be found, uncomment this.
# If libMediaInfo still can't be found, uncomment this.
#export MONO_PATH=${AVDUMP2_HOME}
#export MONO_PATH=${AVDUMP2_HOME}
# Make sure that the locale uses UTF-8 encoding.
# Remove this if your file system actually uses something else.
shopt -s extglob
if [ -z "$LC_ALL" ]; then
  LC_ALL="$LANG"
fi
echo LC_ALL=$LC_ALL
if [ "$LC_ALL" == "${LC_ALL%[Uu][Tt][Ff]?(-)8}" ]; then
  LC_ALL=en_US.UTF-8
fi
export LC_ALL
export LANG="$LC_ALL"


if ! mono ${AVDUMP2_HOME}/AVDump2CL.exe "$@" ; then
if ! mono ${AVDUMP2_HOME}/AVDump2CL.exe "$@" ; then
22

edits

MediaWiki spam blocked by CleanTalk.
MediaWiki spam blocked by CleanTalk.