[libcxx-commits] [libcxx] [libc++] Mostly Implement P1885R12: `<text_encoding>` (PR #141312)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 12 12:48:31 PDT 2026


================
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++26
+// REQUIRES: locale.en_US.UTF-8
+
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: availability-te-environment-missing
+
+// <text_encoding>
+
+// text_encoding text_encoding::environment();
+
+#include <cassert>
+#include <clocale>
+#include <text_encoding>
+
+#include "../test_text_encoding.h"
+#include "platform_support.h"
+
+int main(int, char**) {
+#if !defined(__ANDROID__) || (defined(__ANDROID__) && __ANDROID_API__ >= 26)
+  std::text_encoding te = std::text_encoding::environment();
+  // 1. Depending on the platform's default, verify that environment() returns the corresponding text encoding.
+  {
+#  if defined(__ANDROID__)
+    assert(te.mib() == std::text_encoding::UTF8);
----------------
enh-google wrote:

let me know if you're seeing anything you can't explain --- i'm the person who wrote most of the relevant bits of android's libc :-)

https://github.com/llvm/llvm-project/pull/141312


More information about the libcxx-commits mailing list