diff options
author | jilles <jilles@FreeBSD.org> | 2011-05-08 17:40:10 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-05-08 17:40:10 +0000 |
commit | c9be2081e05e10ddab3dcb7fe31efcc981524e18 (patch) | |
tree | e90b9f059591317bfa02d51bd83a0cf89ad9f520 /tools | |
parent | bf0e27838c7f0e2558fb05339e6f8b74848281c9 (diff) | |
download | FreeBSD-src-c9be2081e05e10ddab3dcb7fe31efcc981524e18.zip FreeBSD-src-c9be2081e05e10ddab3dcb7fe31efcc981524e18.tar.gz |
sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not
possible.
Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/bin/sh/parser/dollar-quote10.0 | 10 | ||||
-rw-r--r-- | tools/regression/bin/sh/parser/dollar-quote11.0 | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/parser/dollar-quote10.0 b/tools/regression/bin/sh/parser/dollar-quote10.0 new file mode 100644 index 0000000..ad166da --- /dev/null +++ b/tools/regression/bin/sh/parser/dollar-quote10.0 @@ -0,0 +1,10 @@ +# $FreeBSD$ + +# a umlaut +s=$(printf '\303\244') +# euro sign +s=$s$(printf '\342\202\254') + +# Start a new shell so the locale change is picked up. +ss="$(LC_ALL=en_US.UTF-8 ${SH} -c "printf %s \$'\u00e4\u20ac'")" +[ "$s" = "$ss" ] diff --git a/tools/regression/bin/sh/parser/dollar-quote11.0 b/tools/regression/bin/sh/parser/dollar-quote11.0 new file mode 100644 index 0000000..2e872ab --- /dev/null +++ b/tools/regression/bin/sh/parser/dollar-quote11.0 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +# some sort of 't' outside BMP +s=$s$(printf '\360\235\225\245') + +# Start a new shell so the locale change is picked up. +ss="$(LC_ALL=en_US.UTF-8 ${SH} -c "printf %s \$'\U0001d565'")" +[ "$s" = "$ss" ] |