#!/bin/sh
#
# test scan(1) with multibytes

. $MH_TEST_COMMON

require_locale en_US.utf-8 en_US.utf8
LC_ALL=en_US.UTF-8
export LC_ALL


cat >"$MH_TEST_DIR/Mail/inbox/11" <<!
Mime-Version: 1.0
From: Bar <bar@example.org>
To: Baz <baz@example.org>
Subject: Subject Test Header
 =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?=
 =?UTF-8?q?=E3=83=98=E3=83=BC=E3=83=87=E3=83=BC?=
Date: Mon, 15 May 2017 15:55:01 +0900
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Message-Id: <20170515065506.03959103B49@example.org>

This is a test email

!

cat >"$MH_TEST_DIR/Mail/inbox/12" <<!
Subject: =?iso-8859-1?Q?Schl=FCssel?=
Mime-Version: 1.0
From: Bob <bob@example.org>
Date: Mon, 22 Sep 2014 01:17:05 +0200
Message-Id: <83C54147-7D2B-4B7F-9502-11C1EB9526BC@example.org>
To: Alice <alice@example.net>
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
        charset=iso-8859-1

Hallo Alice,

hier ist dein Schl=FCssel, ich hoffe das Signieren hat funktioniert. =
Mein =F6ffentlicher Schl=FCssel liegt auf dem Keyserver.

Viele Gr=FC=DFe
Bob

!

runandcheck "scan 12 +inbox" <<!
  12  2014-09-22 01:17  Bob                Schlüssel
!

runandcheck "scan 11-12 +inbox -width 80" <<!
  11  2017-05-15 15:55  Bar                Subject Test Header テストヘー
  12  2014-09-22 01:17  Bob                Schlüssel
!

runandcheck "scan 11-12 +inbox -width 49" <<!
  11  2017-05-15 15:55  Bar                Subje
  12  2014-09-22 01:17  Bob                Schlü
!

LC_ALL=C
unset MM_CHARSET
runandcheck "scan 12 +inbox" <<!
  12  2014-09-22 01:17  Bob                Schl?ssel
!
