From: Stephen Rothwell Date: Mon, 21 Jan 2019 20:39:55 +0000 (+1100) Subject: check_fixes: cope with unicode quotation marks X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=cbf20b0e01794df9d59f05b38319988f7cf74041;p=next-scripts check_fixes: cope with unicode quotation marks --- diff --git a/check_fixes b/check_fixes index 17cfdf0..8618b08 100755 --- a/check_fixes +++ b/check_fixes @@ -73,10 +73,19 @@ has these problem(s): fi # strip matching quotes at the start and end of the subject - re='^(['\''"])(.*)\1$' - if [[ "$subject" =~ $re ]]; then - subject="${BASH_REMATCH[2]}" - elif [[ "$subject" =~ ^[\'\"](.*)$ ]]; then + # the second characters in the classes are + # U+201C LEFT DOUBLE QUOTATION MARK + # U+201D RIGHT DOUBLE QUOTATION MARK + # U+2018 LEFT SINGLE QUOTATION MARK + # U+2019 RIGHT SINGLE QUOTATION MARK + re1=$'^[\"\u201C](.*)[\"\u201D]$' + re2=$'^[\'\u2018](.*)[\'\u2019]$' + re3=$'^[\"\'\u201C\u2018](.*)$' + if [[ "$subject" =~ $re1 ]]; then + subject="${BASH_REMATCH[1]}" + elif [[ "$subject" =~ $re2 ]]; then + subject="${BASH_REMATCH[1]}" + elif [[ "$subject" =~ $re3 ]]; then subject="${BASH_REMATCH[1]}" msg="${msg:+${msg}${nl}} - Subject has leading but no trailing quotes" fi