]> git.plutz.net Git - clickslide/blobdiff - clickslide.sh
portability: prevent crashes in bash
[clickslide] / clickslide.sh
index 5c9d155a57da709d6534d588f2b8c7092f9da458..e78f1c7a30c5568454bd1a8e28d3f1b0f816a4f6 100755 (executable)
@@ -33,7 +33,7 @@ base64() {
       pre="${tag%%url(*)*}"
       post="${tag#*url(*)}"
       file="${tag#${pre}url(}" file="${file%)$post}"
-      file="${file#"}" file="${file%"}"
+      file="${file#\"}" file="${file%\"}"
       echo Inlining Background Image "$file" >&2
       if [ -r "$file" ]; then
         tag="${pre}url('data:image/${file##*.};base64,$(base64 "$file")')${post}"
@@ -55,6 +55,7 @@ base64() {
     case $tag in
       *\<head\>*|\*\<head\ *\>)  # Inline styles into head
         printf '%s<meta name="viewport" content="width=device-width">
+                <meta charset="UTF-8">
                 <style type="text/css"><!--\n' "${tag%${tag#*<head*>}}"
         cat "${0%/*}/clickslide.css"
         printf '\n--></style>%s' "${tag#*<head*>}"