1#!/bin/sh 2# Test non breaking space handling 3 4# Copyright (C) 2019-2023 Free Software Foundation, Inc. 5 6# This program is free software: you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <https://www.gnu.org/licenses/>. 18 19. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 20print_ver_ wc printf 21 22# Before coreutils 8.31 nbsp was treated as part of a word, 23# rather than a word delimiter 24 25check_word_sep() { 26 char="$1" 27 # Use -L to determine whether NBSP is printable. 28 # FreeBSD 11 and OS X treat NBSP as non printable ? 29 if test "$(env printf "=$char=" | wc -L)" = 3; then 30 test $(env printf "=$char=" | wc -w) = 2 || fail=1 31 fi 32} 33 34export LC_ALL=en_US.iso8859-1 # only lowercase form works on macOS 10.15.7 35if test "$(locale charmap 2>/dev/null | sed 's/iso/ISO-/')" = ISO-8859-1; then 36 check_word_sep '\xA0' 37fi 38 39export LC_ALL=en_US.UTF-8 40if test "$(locale charmap 2>/dev/null)" = UTF-8; then 41 check_word_sep '\u00A0' 42 check_word_sep '\u2007' 43 check_word_sep '\u202F' 44 check_word_sep '\u2060' 45fi 46 47export LC_ALL=ru_RU.KOI8-R 48if test "$(locale charmap 2>/dev/null)" = KOI8-R; then 49 check_word_sep '\x9A' 50fi 51 52Exit $fail 53