From 21b5dc8bb5a330b84f6180edd48d08177eb371f7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sat, 8 Nov 2014 18:59:24 -0800
Subject: [PATCH] tests: avoid a multibyte tr portability problem

* tests/init.cfg (tr): New wrapper function.
Reported by Norihiro Tanaka in http://debbugs.gnu.org/18991
---
 tests/init.cfg | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/init.cfg b/tests/init.cfg
index 75a9494..e7a2389 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -162,3 +162,12 @@ hex_printf_()
   printf $(printf '\\%o' \
     $(printf %s "$1"|sed 's,\\x\([0-9a-fA-F][0-9a-fA-F]\), 0x\1,g'))
 }
+
+# Wrap tr so that it always runs in the C locale.
+# Otherwise, in a multibyte locale, GNU tr (which is not multibyte-aware
+# as of 2014-11-08), would work differently than others.  For example,
+# this command, which was written with unibyte GNU tr in mind,
+#   LC_ALL=ja_JP.eucJP tr AB '\244\263'
+# would act like this with the multibyte tr from HP-UX and Solaris:
+#   LC_ALL=ja_JP.eucJP tr A  '\244\263'
+tr() { LC_ALL=C env -- tr "$@"; }
-- 
2.1.2

