UTF-8 filenames don't work properly
Reported by Arle Lommel on the LilyPond users' list:
Use of the wrong encoding for the file system.
I previously reported it on Hans Åberg’s installer.
The build seems to expect file names to use ISO Latin-1 rather than UTF-8, so if you use characters outside of the 7-bit range in your directory tree or file names, you get crashes where Lilypond cannot save the results after processing the file. A log looks like this:
Starting lilypond 2.20.0 [Bartók-Béla-Székely-friss.ly]... Processing `/Users/fenevad/Dropbox/music scores/bartok/Bartók-Béla-Székely-friss.ly' Parsing... Interpreting music... Preprocessing graphical objects... Finding the ideal number of pages... Fitting music on 3 or 4 pages... Drawing systems... Layout output to `/var/folders/64/hl6gpmy17994gn1w87__6yvc0000gn/T//lilypond-7Vi2o3'... Converting to `Bartók-Béla-Székely-friss.pdf'... warning: `(gs -q -dSAFER -dDEVICEWIDTHPOINTS=595.28 -dDEVICEHEIGHTPOINTS=841.89 -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -r1200 -sDEVICE=pdfwrite -dAutoRotatePages=/None -dPrinted=false -sOutputFile=Bartók-Béla-Székely-friss.pdf -c.setpdfwrite -f/var/folders/64/hl6gpmy17994gn1w87__6yvc0000gn/T//lilypond-7Vi2o3)' failed (256) fatal error: failed files: "/Users/fenevad/Dropbox/music scores/bartok/Barto�\x81k-Be�\x81la-Sze�\x81kely-friss.ly" Exited with return code 1.
You can see the problem in the second-to-last line. If I change the file name to lose the non-ASCII characters, it works fine.
Hans reported the following as a solution:
I believe this is bug in the software that LilyPond depends on, MacOS sets LC_CTYPE=UTF-8, and does not set LANG.
I use a script to call it from named ‘lilypond', which can be put in /usr/local/bin/lilypond:
export LC_CTYPE=en_US.UTF-8 export LANG=en_US.UTF-8 exec /opt/lilypond/bin/lilypond "[email protected]“
It can be created and installed as follows: In Terminal write (^D is )
% cat > lilypond export LC_CTYPE=en_US.UTF-8 export LANG=en_US.UTF-8 exec /opt/lilypond/bin/lilypond "[email protected]“ ^D % chmod a+x lilypond % sudo -s cp lilypond /usr/local/bin/lilypond
And 'rm lilypond' if you do not want to keep the script.
Ideally the executables would solve the problem without an external script.