use warnings;
use strict;
use Test::More;
+use utf8;
BEGIN { use_ok("IkiWiki"); }
is(linkpage("foo bar\xACbaz"), "foo_bar__172__baz", 'U+00AC is in Latin-1 range');
is(linkpage("foo bar\x{04D2}baz"), "foo_bar\x{04D2}baz", 'U+04D2 is alphanumeric');
is(linkpage("foo bar\x{2260}baz"), "foo_bar__8800__baz", 'U+2260 is nonalphanumeric');
+is(linkpage("中文"), "中文", 'Chinese');
+is(linkpage("Кириллица"), "Кириллица", 'Cyrillic');
is(linkpage("foo bar\x{0001F4A9}baz"), "foo_bar__128169__baz", 'U+1F4A9 is outside BMP');
done_testing;
is(pagetitle("foo_bar__8800__baz"), "foo bar≠baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz"), "foo bar ! baz", 'Exclamation mark');
is(pagetitle("foo_bar___95___baz"), "foo bar _ baz", 'Underscore');
+is(pagetitle("中文"), "中文", 'Chinese');
+is(pagetitle("Кириллица"), "Кириллица", 'Cyrillic');
# Outside basic multilingual plane: 💩 is U+1F4A9 PILE OF POO
is(pagetitle("foo_bar__128169__baz"), "foo bar💩baz", 'Unicode outside BMP');
is(pagetitle("foo_bar__8800__baz", undef), "foo bar≠baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz", ""), "foo bar ! baz", 'Exclamation mark');
is(pagetitle("foo_bar___95___baz", 0), "foo bar _ baz", 'Underscore');
+is(pagetitle("中文", 0), "中文", 'Chinese');
+is(pagetitle("Кириллица", 0), "Кириллица", 'Cyrillic');
is(pagetitle("foo_bar__128169__baz", 0), "foo bar💩baz", 'Unicode outside BMP');
# pagetitle(x, true) => unescaped form of page title
is(pagetitle("foo_bar__8800__baz", 1), "foo bar\x{2260}baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz", 1), "foo bar ! baz");
is(pagetitle("foo_bar___95___baz", 1), "foo bar _ baz");
+is(pagetitle("中文", 1), "中文", 'Chinese');
+is(pagetitle("Кириллица", 1), "Кириллица", 'Cyrillic');
is(chr(128169), "\x{0001F4A9}");
is(pagetitle("foo_bar__128169__baz", 1), "foo bar\x{0001F4A9}baz", 'Unicode outside BMP');
use warnings;
use strict;
use Test::More;
+use utf8;
BEGIN { use_ok("IkiWiki"); }
is(titlepage("foo bar\xACbaz"), "foo_bar__172__baz", 'U+00AC is in Latin-1 range');
is(titlepage("foo bar\x{04D2}baz"), "foo_bar\x{04D2}baz", 'U+04D2 is alphanumeric');
is(titlepage("foo bar\x{2260}baz"), "foo_bar__8800__baz", 'U+2260 is nonalphanumeric');
+is(titlepage("中文"), "中文", 'Chinese');
+is(titlepage("Кириллица"), "Кириллица", 'Cyrillic');
is(titlepage("foo bar\x{0001F4A9}baz"), "foo_bar__128169__baz", 'U+1F4A9 is outside BMP');
done_testing;