Test high-valued unicode characters in app.alert()

Tie pdfium_test to the us_EN.UTF-8 locale so that these will
print consistently (they fail to print entirely in the "C"
locale).

Change-Id: I61c9e75666392e4b054a98cc67e11d67e6066503
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93771
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 5703d83..16e2ba7 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1255,6 +1256,8 @@
 }  // namespace
 
 int main(int argc, const char* argv[]) {
+  setlocale(LC_CTYPE, "en_US.UTF-8");  // For printf() of high-characters.
+
   std::vector<std::string> args(argv, argv + argc);
   Options options;
   std::vector<std::string> files;
diff --git a/testing/resources/javascript/app_methods.in b/testing/resources/javascript/app_methods.in
index fddcd64..1c01e84 100644
--- a/testing/resources/javascript/app_methods.in
+++ b/testing/resources/javascript/app_methods.in
@@ -35,7 +35,8 @@
 {{include expect.js}}
 
 try {
-  expect("app.alert('message', 1, 2, 'title')", 0);
+  // Test unicode support, no particular reason for these CJK characters.
+  expect("app.alert('message \u4023', 1, 2, 'title \u4024')", 0);
   expect("app.alert({'cMsg': 'message', 'cTitle': 'title'})", 0);
   expect("app.alert({'cMsg': 'message', 'cTitle': 'title', 'nIcon': 3, 'nType': 4})", 0);
   expect("app.alert(undefined)", 0);
diff --git a/testing/resources/javascript/app_methods_expected.txt b/testing/resources/javascript/app_methods_expected.txt
index 015ff28..86fb3a9 100644
--- a/testing/resources/javascript/app_methods_expected.txt
+++ b/testing/resources/javascript/app_methods_expected.txt
@@ -1,5 +1,5 @@
-title[icon=1,type=2]: message
-Alert: PASS: app.alert('message', 1, 2, 'title') = 0
+title 䀤[icon=1,type=2]: message 䀣
+Alert: PASS: app.alert('message 䀣', 1, 2, 'title 䀤') = 0
 title: message
 Alert: PASS: app.alert({'cMsg': 'message', 'cTitle': 'title'}) = 0
 title[icon=3,type=4]: message