[libcxx-commits] [libcxx] [libc++] Mostly Implement P1885R12: `<text_encoding>` (PR #141312)
William Tran-Viet via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 23 19:49:16 PST 2026
https://github.com/smallp-o-p updated https://github.com/llvm/llvm-project/pull/141312
>From 3309926c7636acca750d9e5aa74219ba552d1136 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Fri, 23 May 2025 22:08:36 -0400
Subject: [PATCH 01/17] Implement P1885R12
---
libcxx/docs/FeatureTestMacroTable.rst | 2 +-
libcxx/docs/Status/Cxx2cIssues.csv | 2 +-
libcxx/docs/Status/Cxx2cPapers.csv | 4 +-
libcxx/include/CMakeLists.txt | 2 +
libcxx/include/__configuration/availability.h | 5 +-
libcxx/include/__locale_dir/locale_base_api.h | 9 +-
.../include/__locale_dir/support/bsd_like.h | 8 +-
libcxx/include/__locale_dir/support/linux.h | 11 +-
libcxx/include/__text_encoding/te_impl.h | 1441 +++++++++++++++++
libcxx/include/module.modulemap.in | 7 +
libcxx/include/text_encoding | 142 ++
libcxx/include/version | 2 +-
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...bcxxabi.v1.stable.exceptions.nonew.abilist | 1 +
...xxabi.v1.stable.noexceptions.nonew.abilist | 1 +
libcxx/modules/std.compat.cppm.in | 3 -
libcxx/modules/std.cppm.in | 4 +-
libcxx/modules/std/text_encoding.inc | 11 +-
libcxx/src/CMakeLists.txt | 1 +
libcxx/src/text_encoding.cpp | 256 +++
.../test/libcxx/transitive_includes/cxx03.csv | 33 +
.../test/libcxx/transitive_includes/cxx11.csv | 33 +
.../test/libcxx/transitive_includes/cxx14.csv | 34 +
.../test/libcxx/transitive_includes/cxx17.csv | 33 +
.../test/libcxx/transitive_includes/cxx20.csv | 33 +
.../test/libcxx/transitive_includes/cxx23.csv | 13 +
.../test/libcxx/transitive_includes/cxx26.csv | 13 +
.../text_encoding/environment.pass.cpp | 38 +
.../text_encoding.ctor/assert.id.pass.cpp | 34 +
.../assert.string_view.pass.cpp | 37 +
.../environment.nodiscard.verify.cpp | 30 +
.../nodiscard.verify.cpp | 31 +
.../text_encoding.version.compile.pass.cpp | 62 +
.../version.version.compile.pass.cpp | 16 +-
.../get_long_double_fr_FR.pass.cpp | 5 +
.../put_long_double_fr_FR.pass.cpp | 5 +
.../locale/locale.members/encoding.pass.cpp | 53 +
.../text_encoding/test_text_encoding.h | 282 ++++
.../text_encoding.ctor/default.pass.cpp | 41 +
.../text_encoding.ctor/id.pass.cpp | 84 +
.../text_encoding.ctor/string_view.pass.cpp | 98 ++
.../text_encoding.eq/equal.id.pass.cpp | 74 +
.../text_encoding.eq/equal.pass.cpp | 64 +
.../text_encoding.hash/enabled_hash.pass.cpp | 24 +
.../text_encoding.hash/hash.pass.cpp | 58 +
.../aliases_view.compile.pass.cpp | 23 +
.../environment.pass.cpp | 50 +
.../text_encoding.members/literal.pass.cpp | 36 +
.../text_encoding.aliases_view/begin.pass.cpp | 63 +
.../text_encoding.aliases_view/empty.pass.cpp | 76 +
.../text_encoding.aliases_view/end.pass.cpp | 34 +
.../text_encoding.aliases_view/front.pass.cpp | 63 +
.../iterator.pass.cpp | 103 ++
.../trivially_copyable.compile.pass.cpp | 16 +
libcxx/test/support/platform_support.h | 1 +
.../generate_feature_test_macro_components.py | 1 -
libcxx/utils/libcxx/header_information.py | 1 -
.../libcxx/test/features/availability.py | 8 +
63 files changed, 3587 insertions(+), 34 deletions(-)
create mode 100644 libcxx/include/__text_encoding/te_impl.h
create mode 100644 libcxx/include/text_encoding
create mode 100644 libcxx/src/text_encoding.cpp
create mode 100644 libcxx/test/libcxx/utilities/text_encoding/environment.pass.cpp
create mode 100644 libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
create mode 100644 libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
create mode 100644 libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/environment.nodiscard.verify.cpp
create mode 100644 libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/nodiscard.verify.cpp
create mode 100644 libcxx/test/std/language.support/support.limits/support.limits.general/text_encoding.version.compile.pass.cpp
create mode 100644 libcxx/test/std/localization/locales/locale/locale.members/encoding.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/test_text_encoding.h
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.hash/enabled_hash.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.hash/hash.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/literal.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/empty.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/front.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
create mode 100644 libcxx/test/std/utilities/text_encoding/trivially_copyable.compile.pass.cpp
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index d2b76cb96e866..13dac625c7502 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -524,7 +524,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_submdspan`` *unimplemented*
---------------------------------------------------------- -----------------
- ``__cpp_lib_text_encoding`` *unimplemented*
+ ``__cpp_lib_text_encoding`` ``202306L``
---------------------------------------------------------- -----------------
``__cpp_lib_to_chars`` *unimplemented*
---------------------------------------------------------- -----------------
diff --git a/libcxx/docs/Status/Cxx2cIssues.csv b/libcxx/docs/Status/Cxx2cIssues.csv
index 101a708b7b2de..f066eca24f3d3 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -56,7 +56,7 @@
"`LWG4035 <https://wg21.link/LWG4035>`__","``single_view`` should provide ``empty``","2024-03 (Tokyo)","|Complete|","19","`#105328 <https://github.com/llvm/llvm-project/issues/105328>`__",""
"`LWG4036 <https://wg21.link/LWG4036>`__","``__alignof_is_defined`` is only implicitly specified in C++ and not yet deprecated","2024-03 (Tokyo)","","","`#105329 <https://github.com/llvm/llvm-project/issues/105329>`__",""
"`LWG4037 <https://wg21.link/LWG4037>`__","Static data members of ``ctype_base`` are not yet required to be usable in constant expressions","2024-03 (Tokyo)","","","`#105330 <https://github.com/llvm/llvm-project/issues/105330>`__",""
-"`LWG4038 <https://wg21.link/LWG4038>`__","``std::text_encoding::aliases_view`` should have constexpr iterators","2024-03 (Tokyo)","","","`#105332 <https://github.com/llvm/llvm-project/issues/105332>`__",""
+"`LWG4038 <https://wg21.link/LWG4038>`__","``std::text_encoding::aliases_view`` should have constexpr iterators","2024-03 (Tokyo)","|Complete|","","`#105332 <https://github.com/llvm/llvm-project/issues/105332>`__",""
"`LWG4043 <https://wg21.link/LWG4043>`__","""ASCII"" is not a registered character encoding","2024-03 (Tokyo)","|Nothing To Do|","","`#105335 <https://github.com/llvm/llvm-project/issues/105335>`__",""
"`LWG4045 <https://wg21.link/LWG4045>`__","``tuple`` can create dangling references from ``tuple-like``","2024-03 (Tokyo)","","","`#105337 <https://github.com/llvm/llvm-project/issues/105337>`__",""
"`LWG4053 <https://wg21.link/LWG4053>`__","Unary call to ``std::views::repeat`` does not decay the argument","2024-03 (Tokyo)","|Complete|","19","`#105338 <https://github.com/llvm/llvm-project/issues/105338>`__",""
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv
index 29642fc53cac6..77e488654099a 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -13,7 +13,7 @@
"`P2013R5 <https://wg21.link/P2013R5>`__","Freestanding Language: Optional ``::operator new``","2023-06 (Varna)","","","`#105370 <https://github.com/llvm/llvm-project/issues/105370>`__",""
"`P2363R5 <https://wg21.link/P2363R5>`__","Extending associative containers with the remaining heterogeneous overloads","2023-06 (Varna)","","","`#105371 <https://github.com/llvm/llvm-project/issues/105371>`__",""
"`P1901R2 <https://wg21.link/P1901R2>`__","Enabling the Use of ``weak_ptr`` as Keys in Unordered Associative Containers","2023-06 (Varna)","","","`#105372 <https://github.com/llvm/llvm-project/issues/105372>`__",""
-"`P1885R12 <https://wg21.link/P1885R12>`__","Naming Text Encodings to Demystify Them","2023-06 (Varna)","","","`#105373 <https://github.com/llvm/llvm-project/issues/105373>`__",""
+"`P1885R12 <https://wg21.link/P1885R12>`__","Naming Text Encodings to Demystify Them","2023-06 (Varna)","|Partial|","22","`#105373 <https://github.com/llvm/llvm-project/issues/105373>`__","locale::encoding() is not yet implemented."
"`P0792R14 <https://wg21.link/P0792R14>`__","``function_ref``: a type-erased callable reference","2023-06 (Varna)","","","`#105376 <https://github.com/llvm/llvm-project/issues/105376>`__",""
"`P2874R2 <https://wg21.link/P2874R2>`__","P2874R2: Mandating Annex D Require No More","2023-06 (Varna)","|Complete|","12","`#105377 <https://github.com/llvm/llvm-project/issues/105377>`__",""
"`P2757R3 <https://wg21.link/P2757R3>`__","Type-checking format args","2023-06 (Varna)","","","`#105378 <https://github.com/llvm/llvm-project/issues/105378>`__",""
@@ -79,7 +79,7 @@
"`P3136R1 <https://wg21.link/P3136R1>`__","Retiring niebloids","2024-11 (Wrocław)","|Complete|","14","`#118133 <https://github.com/llvm/llvm-project/issues/118133>`__",""
"`P3138R5 <https://wg21.link/P3138R5>`__","``views::cache_latest``","2024-11 (Wrocław)","","","`#118134 <https://github.com/llvm/llvm-project/issues/118134>`__",""
"`P3379R0 <https://wg21.link/P3379R0>`__","Constrain ``std::expected`` equality operators","2024-11 (Wrocław)","|Complete|","21","`#118135 <https://github.com/llvm/llvm-project/issues/118135>`__",""
-"`P2862R1 <https://wg21.link/P2862R1>`__","``text_encoding::name()`` should never return null values","2024-11 (Wrocław)","","","`#118371 <https://github.com/llvm/llvm-project/issues/118371>`__",""
+"`P2862R1 <https://wg21.link/P2862R1>`__","``text_encoding::name()`` should never return null values","2024-11 (Wrocław)","|Complete|","22","`#118371 <https://github.com/llvm/llvm-project/issues/118371>`__",""
"`P2897R7 <https://wg21.link/P2897R7>`__","``aligned_accessor``: An ``mdspan`` accessor expressing pointer over-alignment","2024-11 (Wrocław)","|Complete|","21","`#118372 <https://github.com/llvm/llvm-project/issues/118372>`__",""
"`P3355R2 <https://wg21.link/P3355R2>`__","Fix ``submdspan`` for C++26","2024-11 (Wrocław)","","","`#118373 <https://github.com/llvm/llvm-project/issues/118373>`__",""
"`P3222R0 <https://wg21.link/P3222R0>`__","Fix C++26 by adding transposed special cases for P2642 layouts","2024-11 (Wrocław)","","","`#118374 <https://github.com/llvm/llvm-project/issues/118374>`__",""
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index dc6c262fad17e..5d52ea5e53677 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -779,6 +779,7 @@ set(files
__system_error/error_condition.h
__system_error/system_error.h
__system_error/throw_system_error.h
+ __text_encoding/te_impl.h
__thread/formatter.h
__thread/id.h
__thread/jthread.h
@@ -1086,6 +1087,7 @@ set(files
strstream
syncstream
system_error
+ text_encoding
tgmath.h
thread
tuple
diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h
index f70e1b2034772..cd79036b9db68 100644
--- a/libcxx/include/__configuration/availability.h
+++ b/libcxx/include/__configuration/availability.h
@@ -71,7 +71,6 @@
// clang-format off
// LLVM 22
-// TODO: Fill this in
# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
@@ -295,6 +294,10 @@
#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
// No attribute, since we've had bad_function_call::what() in the headers before
+// Controls whether the internal implementation for text_encoding::environment() -> te_impl::__environment() is available
+#define _LIBCPP_AVAILABILITY_HAS_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22
+#define _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
+
// Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older
# if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8
# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index 0474c1db359de..56826c8e636f1 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -139,6 +139,7 @@
# include <__cstddef/size_t.h>
# include <__utility/forward.h>
# include <ctype.h>
+# include <langinfo.h>
# include <string.h>
# include <time.h>
# if _LIBCPP_HAS_WIDE_CHARACTERS
@@ -157,6 +158,7 @@ namespace __locale {
# define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
# define _LIBCPP_ALL_MASK LC_ALL_MASK
# define _LIBCPP_LC_ALL LC_ALL
+# define _LIBCPP_NL_CODESET CODESET
using __locale_t _LIBCPP_NODEBUG = locale_t;
@@ -268,7 +270,12 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
return __libcpp_mbsrtowcs_l(__dest, __src, __len, __ps, __loc);
}
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
-# endif // _LIBCPP_BUILDING_LIBRARY
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __nl_langinfo_l(decltype(_LIBCPP_NL_CODESET) __item, __locale_t __loc) {
+ return ::nl_langinfo_l(__item, __loc);
+}
+
+# endif // _LIBCPP_BUILDING_LIBRARY
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
diff --git a/libcxx/include/__locale_dir/support/bsd_like.h b/libcxx/include/__locale_dir/support/bsd_like.h
index 6f533b4e1eab1..c3c1aadefa1e8 100644
--- a/libcxx/include/__locale_dir/support/bsd_like.h
+++ b/libcxx/include/__locale_dir/support/bsd_like.h
@@ -15,6 +15,7 @@
#include <__utility/forward.h>
#include <clocale> // std::lconv
#include <ctype.h>
+#include <langinfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -46,6 +47,7 @@ namespace __locale {
#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
#define _LIBCPP_ALL_MASK LC_ALL_MASK
#define _LIBCPP_LC_ALL LC_ALL
+#define _LIBCPP_NL_CODESET CODESET
using __locale_t _LIBCPP_NODEBUG = ::locale_t;
#if defined(_LIBCPP_BUILDING_LIBRARY)
@@ -180,7 +182,11 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
return ::mbsrtowcs_l(__dest, __src, __len, __ps, __loc);
}
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
-#endif // _LIBCPP_BUILDING_LIBRARY
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __nl_langinfo_l(decltype(_LIBCPP_NL_CODESET) __item, __locale_t __loc) {
+ return ::nl_langinfo_l(__item, __loc);
+}
+#endif // _LIBCPP_BUILDING_LIBRARY
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
diff --git a/libcxx/include/__locale_dir/support/linux.h b/libcxx/include/__locale_dir/support/linux.h
index 1a589be49bf1d..96bda017cee43 100644
--- a/libcxx/include/__locale_dir/support/linux.h
+++ b/libcxx/include/__locale_dir/support/linux.h
@@ -17,6 +17,7 @@
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
+#include <langinfo.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
@@ -57,6 +58,7 @@ struct __locale_guard {
#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
#define _LIBCPP_ALL_MASK LC_ALL_MASK
#define _LIBCPP_LC_ALL LC_ALL
+#define _LIBCPP_NL_CODESET CODESET
using __locale_t _LIBCPP_NODEBUG = ::locale_t;
@@ -211,7 +213,14 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
return std::mbsrtowcs(__dest, __src, __len, __ps);
}
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
-#endif // _LIBCPP_BUILDING_LIBRARY
+
+// TODO: Android has langinfo.h but not nl_langinfo_l
+# ifndef __ANDROID__
+inline _LIBCPP_HIDE_FROM_ABI const char* __nl_langinfo_l(decltype(_LIBCPP_NL_CODESET) __item, __locale_t __loc) {
+ return ::nl_langinfo_l(__item, __loc);
+}
+# endif
+#endif // _LIBCPP_BUILDING_LIBRARY
#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
_LIBCPP_HIDE_FROM_ABI
diff --git a/libcxx/include/__text_encoding/te_impl.h b/libcxx/include/__text_encoding/te_impl.h
new file mode 100644
index 0000000000000..2192735b027fa
--- /dev/null
+++ b/libcxx/include/__text_encoding/te_impl.h
@@ -0,0 +1,1441 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP__TEXT_ENCODING_TE_IMPL_H
+#define _LIBCPP__TEXT_ENCODING_TE_IMPL_H
+
+#include <__algorithm/copy_n.h>
+#include <__algorithm/find.h>
+#include <__algorithm/lower_bound.h>
+#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/view_interface.h>
+#include <cstdint>
+#include <string_view>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct __te_impl {
+private:
+ friend struct text_encoding;
+ enum class __id : int_least32_t {
+ other = 1,
+ unknown = 2,
+ ASCII = 3,
+ ISOLatin1 = 4,
+ ISOLatin2 = 5,
+ ISOLatin3 = 6,
+ ISOLatin4 = 7,
+ ISOLatinCyrillic = 8,
+ ISOLatinArabic = 9,
+ ISOLatinGreek = 10,
+ ISOLatinHebrew = 11,
+ ISOLatin5 = 12,
+ ISOLatin6 = 13,
+ ISOTextComm = 14,
+ HalfWidthKatakana = 15,
+ JISEncoding = 16,
+ ShiftJIS = 17,
+ EUCPkdFmtJapanese = 18,
+ EUCFixWidJapanese = 19,
+ ISO4UnitedKingdom = 20,
+ ISO11SwedishForNames = 21,
+ ISO15Italian = 22,
+ ISO17Spanish = 23,
+ ISO21German = 24,
+ ISO60DanishNorwegian = 25,
+ ISO69French = 26,
+ ISO10646UTF1 = 27,
+ ISO646basic1983 = 28,
+ INVARIANT = 29,
+ ISO2IntlRefVersion = 30,
+ NATSSEFI = 31,
+ NATSSEFIADD = 32,
+ ISO10Swedish = 35,
+ KSC56011987 = 36,
+ ISO2022KR = 37,
+ EUCKR = 38,
+ ISO2022JP = 39,
+ ISO2022JP2 = 40,
+ ISO13JISC6220jp = 41,
+ ISO14JISC6220ro = 42,
+ ISO16Portuguese = 43,
+ ISO18Greek7Old = 44,
+ ISO19LatinGreek = 45,
+ ISO25French = 46,
+ ISO27LatinGreek1 = 47,
+ ISO5427Cyrillic = 48,
+ ISO42JISC62261978 = 49,
+ ISO47BSViewdata = 50,
+ ISO49INIS = 51,
+ ISO50INIS8 = 52,
+ ISO51INISCyrillic = 53,
+ ISO54271981 = 54,
+ ISO5428Greek = 55,
+ ISO57GB1988 = 56,
+ ISO58GB231280 = 57,
+ ISO61Norwegian2 = 58,
+ ISO70VideotexSupp1 = 59,
+ ISO84Portuguese2 = 60,
+ ISO85Spanish2 = 61,
+ ISO86Hungarian = 62,
+ ISO87JISX0208 = 63,
+ ISO88Greek7 = 64,
+ ISO89ASMO449 = 65,
+ ISO90 = 66,
+ ISO91JISC62291984a = 67,
+ ISO92JISC62991984b = 68,
+ ISO93JIS62291984badd = 69,
+ ISO94JIS62291984hand = 70,
+ ISO95JIS62291984handadd = 71,
+ ISO96JISC62291984kana = 72,
+ ISO2033 = 73,
+ ISO99NAPLPS = 74,
+ ISO102T617bit = 75,
+ ISO103T618bit = 76,
+ ISO111ECMACyrillic = 77,
+ ISO121Canadian1 = 78,
+ ISO122Canadian2 = 79,
+ ISO123CSAZ24341985gr = 80,
+ ISO88596E = 81,
+ ISO88596I = 82,
+ ISO128T101G2 = 83,
+ ISO88598E = 84,
+ ISO88598I = 85,
+ ISO139CSN369103 = 86,
+ ISO141JUSIB1002 = 87,
+ ISO143IECP271 = 88,
+ ISO146Serbian = 89,
+ ISO147Macedonian = 90,
+ ISO150 = 91,
+ ISO151Cuba = 92,
+ ISO6937Add = 93,
+ ISO153GOST1976874 = 94,
+ ISO8859Supp = 95,
+ ISO10367Box = 96,
+ ISO158Lap = 97,
+ ISO159JISX02121990 = 98,
+ ISO646Danish = 99,
+ USDK = 100,
+ DKUS = 101,
+ KSC5636 = 102,
+ Unicode11UTF7 = 103,
+ ISO2022CN = 104,
+ ISO2022CNEXT = 105,
+ UTF8 = 106,
+ ISO885913 = 109,
+ ISO885914 = 110,
+ ISO885915 = 111,
+ ISO885916 = 112,
+ GBK = 113,
+ GB18030 = 114,
+ OSDEBCDICDF0415 = 115,
+ OSDEBCDICDF03IRV = 116,
+ OSDEBCDICDF041 = 117,
+ ISO115481 = 118,
+ KZ1048 = 119,
+ UCS2 = 1000,
+ UCS4 = 1001,
+ UnicodeASCII = 1002,
+ UnicodeLatin1 = 1003,
+ UnicodeJapanese = 1004,
+ UnicodeIBM1261 = 1005,
+ UnicodeIBM1268 = 1006,
+ UnicodeIBM1276 = 1007,
+ UnicodeIBM1264 = 1008,
+ UnicodeIBM1265 = 1009,
+ Unicode11 = 1010,
+ SCSU = 1011,
+ UTF7 = 1012,
+ UTF16BE = 1013,
+ UTF16LE = 1014,
+ UTF16 = 1015,
+ CESU8 = 1016,
+ UTF32 = 1017,
+ UTF32BE = 1018,
+ UTF32LE = 1019,
+ BOCU1 = 1020,
+ UTF7IMAP = 1021,
+ Windows30Latin1 = 2000,
+ Windows31Latin1 = 2001,
+ Windows31Latin2 = 2002,
+ Windows31Latin5 = 2003,
+ HPRoman8 = 2004,
+ AdobeStandardEncoding = 2005,
+ VenturaUS = 2006,
+ VenturaInternational = 2007,
+ DECMCS = 2008,
+ PC850Multilingual = 2009,
+ PC8DanishNorwegian = 2012,
+ PC862LatinHebrew = 2013,
+ PC8Turkish = 2014,
+ IBMSymbols = 2015,
+ IBMThai = 2016,
+ HPLegal = 2017,
+ HPPiFont = 2018,
+ HPMath8 = 2019,
+ HPPSMath = 2020,
+ HPDesktop = 2021,
+ VenturaMath = 2022,
+ MicrosoftPublishing = 2023,
+ Windows31J = 2024,
+ GB2312 = 2025,
+ Big5 = 2026,
+ Macintosh = 2027,
+ IBM037 = 2028,
+ IBM038 = 2029,
+ IBM273 = 2030,
+ IBM274 = 2031,
+ IBM275 = 2032,
+ IBM277 = 2033,
+ IBM278 = 2034,
+ IBM280 = 2035,
+ IBM281 = 2036,
+ IBM284 = 2037,
+ IBM285 = 2038,
+ IBM290 = 2039,
+ IBM297 = 2040,
+ IBM420 = 2041,
+ IBM423 = 2042,
+ IBM424 = 2043,
+ PC8CodePage437 = 2011,
+ IBM500 = 2044,
+ IBM851 = 2045,
+ PCp852 = 2010,
+ IBM855 = 2046,
+ IBM857 = 2047,
+ IBM860 = 2048,
+ IBM861 = 2049,
+ IBM863 = 2050,
+ IBM864 = 2051,
+ IBM865 = 2052,
+ IBM868 = 2053,
+ IBM869 = 2054,
+ IBM870 = 2055,
+ IBM871 = 2056,
+ IBM880 = 2057,
+ IBM891 = 2058,
+ IBM903 = 2059,
+ IBM904 = 2060,
+ IBM905 = 2061,
+ IBM918 = 2062,
+ IBM1026 = 2063,
+ IBMEBCDICATDE = 2064,
+ EBCDICATDEA = 2065,
+ EBCDICCAFR = 2066,
+ EBCDICDKNO = 2067,
+ EBCDICDKNOA = 2068,
+ EBCDICFISE = 2069,
+ EBCDICFISEA = 2070,
+ EBCDICFR = 2071,
+ EBCDICIT = 2072,
+ EBCDICPT = 2073,
+ EBCDICES = 2074,
+ EBCDICESA = 2075,
+ EBCDICESS = 2076,
+ EBCDICUK = 2077,
+ EBCDICUS = 2078,
+ Unknown8BiT = 2079,
+ Mnemonic = 2080,
+ Mnem = 2081,
+ VISCII = 2082,
+ VIQR = 2083,
+ KOI8R = 2084,
+ HZGB2312 = 2085,
+ IBM866 = 2086,
+ PC775Baltic = 2087,
+ KOI8U = 2088,
+ IBM00858 = 2089,
+ IBM00924 = 2090,
+ IBM01140 = 2091,
+ IBM01141 = 2092,
+ IBM01142 = 2093,
+ IBM01143 = 2094,
+ IBM01144 = 2095,
+ IBM01145 = 2096,
+ IBM01146 = 2097,
+ IBM01147 = 2098,
+ IBM01148 = 2099,
+ IBM01149 = 2100,
+ Big5HKSCS = 2101,
+ IBM1047 = 2102,
+ PTCP154 = 2103,
+ Amiga1251 = 2104,
+ KOI7switched = 2105,
+ BRF = 2106,
+ TSCII = 2107,
+ CP51932 = 2108,
+ windows874 = 2109,
+ windows1250 = 2250,
+ windows1251 = 2251,
+ windows1252 = 2252,
+ windows1253 = 2253,
+ windows1254 = 2254,
+ windows1255 = 2255,
+ windows1256 = 2256,
+ windows1257 = 2257,
+ windows1258 = 2258,
+ TIS620 = 2259,
+ CP50220 = 2260
+ };
+
+ using enum __id;
+ static constexpr size_t __max_name_length_ = 63;
+
+ struct __te_data {
+ const char* __name_;
+ int_least32_t __mib_rep_;
+ uint16_t __name_size_;
+ uint16_t __to_end_;
+ // The encoding data knows the end of its range to simplify iterator implementation.
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, const __te_data& __other) noexcept {
+ return __e.__mib_rep_ == __other.__mib_rep_ ||
+ __comp_name(string_view(__e.__name_, __e.__name_size_), string_view(__other.__name_, __e.__name_size_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __te_data& __e, const int_least32_t __i) noexcept {
+ return __e.__mib_rep_ < __i;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, std::string_view __name) noexcept {
+ return __comp_name(__name, string_view(__e.__name_, __e.__name_size_));
+ }
+ }; // __te_data
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __comp_name(string_view __a, string_view __b) {
+ if (__a.empty() || __b.empty()) {
+ return false;
+ }
+
+ // Map any non-alphanumeric character to 255, skip prefix 0s, else get tolower(__n).
+ auto __map_char = [](char __n, bool& __in_number) -> unsigned char {
+ auto __to_lower = [](char __n_in) -> char {
+ return (__n_in >= 'A' && __n_in <= 'Z') ? __n_in + ('a' - 'A') : __n_in;
+ };
+ if (__n == '0') {
+ return __in_number ? '0' : 255;
+ }
+ __in_number = __n >= '1' && __n <= '9';
+ return (__n >= '1' && __n <= '9') || (__n >= 'A' && __n <= 'Z') || (__n >= 'a' && __n <= 'z')
+ ? __to_lower(__n)
+ : 255;
+ };
+
+ auto __a_ptr = __a.begin(), __b_ptr = __b.begin();
+ bool __a_in_number = false, __b_in_number = false;
+
+ unsigned char __a_val = 255, __b_val = 255;
+ for (;; __a_ptr++, __b_ptr++) {
+ while (__a_ptr != __a.end() && (__a_val = __map_char(*__a_ptr, __a_in_number)) == 255)
+ __a_ptr++;
+ while (__b_ptr != __b.end() && (__b_val = __map_char(*__b_ptr, __b_in_number)) == 255)
+ __b_ptr++;
+
+ if (__a_ptr == __a.end())
+ return __b_ptr == __b.end();
+ if (__b_ptr == __b.end())
+ return false;
+ if (__a_val != __b_val)
+ return false;
+ }
+ return true;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr const __te_data* __find_encoding_data(string_view __a) {
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __a.size() <= __max_name_length_ && !__a.contains('\0'), "invalid string passed to text_encoding(string_view)");
+ const __te_data* __data_first = __text_encoding_data + 2;
+ const __te_data* __data_last = std::end(__text_encoding_data);
+
+ auto* __found_data = std::find(__data_first, __data_last, __a);
+
+ if (__found_data == __data_last) {
+ return __text_encoding_data; // other
+ }
+
+ while (__found_data[-1].__mib_rep_ == __found_data->__mib_rep_) {
+ __found_data--;
+ }
+
+ return __found_data;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr const __te_data* __find_encoding_data_by_id(__id __i) {
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ ((__i >= __id::other && __i <= __id::CP50220) && ((int_least32_t(__i) != 33) && (int_least32_t(__i) != 34))),
+ "invalid text_encoding::id passed to text_encoding(id)");
+ auto __found =
+ std::lower_bound(std::begin(__text_encoding_data), std::end(__text_encoding_data), int_least32_t(__i));
+
+ return __found != std::end(__text_encoding_data)
+ ? __found
+ : __text_encoding_data + 1; // unknown, should be unreachable
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __te_impl() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __te_impl(string_view __enc) noexcept
+ : __encoding_rep_(__find_encoding_data(__enc)) {
+ __enc.copy(__name_, __max_name_length_, 0);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __te_impl(__id __i) noexcept : __encoding_rep_(__find_encoding_data_by_id(__i)) {
+ if (__encoding_rep_->__name_[0] != '\0')
+ std::copy_n(__encoding_rep_->__name_, __encoding_rep_->__name_size_, __name_);
+ }
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __id __mib() const noexcept {
+ return __id(__encoding_rep_->__mib_rep_);
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr const char* __name() const noexcept { return __name_; }
+
+ // [text.encoding.aliases], class text_encoding::aliases_view
+ struct __aliases_view : ranges::view_interface<__aliases_view> {
+ struct __iterator {
+ using iterator_concept = random_access_iterator_tag;
+ using iterator_category = random_access_iterator_tag;
+ using value_type = const char*;
+ using reference = const char*;
+ using difference_type = ptrdiff_t;
+
+ constexpr __iterator() noexcept = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return __data_->__name_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr value_type operator[](difference_type __n) const {
+ auto __it = *this;
+ return *(__it + __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __it, difference_type __n) {
+ __it += __n;
+ return __it;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __it) {
+ __it += __n;
+ return __it;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __it, difference_type __n) {
+ __it -= __n;
+ return __it;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr difference_type operator-(const __iterator& __other) const {
+ return __data_ - __other.__data_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(difference_type __n, __iterator& __it) {
+ __it -= __n;
+ return __it;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ __data_++;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
+ auto __old = *this;
+ __data_++;
+ return __old;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() {
+ __data_--;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) {
+ auto __old = *this;
+ __data_--;
+ return __old;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) {
+ __data_ += __n;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) { return operator+=(-__n); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const __iterator& __it) const { return __data_ == __it.__data_; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(__iterator __it) const { return __data_ <=> __it.__data_; }
+
+ private:
+ friend struct __aliases_view;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(const __te_data* __enc_d) noexcept : __data_(__enc_d) {}
+
+ const __te_data* __data_;
+ }; // __iterator
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__view_data_}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const {
+ return __iterator{__view_data_ + __view_data_->__to_end_};
+ }
+
+ private:
+ friend struct __te_impl;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view(const __te_data* __d) : __view_data_(__d) {}
+ const __te_data* __view_data_;
+ };
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view __aliases() const {
+ return __aliases_view(__encoding_rep_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __a, const __te_impl& __b) noexcept {
+ return __a.__mib() == __id::other && __b.__mib() == __id::other
+ ? __comp_name(__a.__name_, __b.__name_)
+ : __a.__mib() == __b.__mib();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __encoding, const __id __i) noexcept {
+ return __encoding.__mib() == __i;
+ }
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static consteval __te_impl __literal() noexcept {
+ // TODO: Remove this branch once we have __GNUC_EXECUTION_CHARSET_NAME or __clang_literal_encoding__ unconditionally
+# ifdef __GNUC_EXECUTION_CHARSET_NAME
+ return __te_impl(__GNUC_EXECUTION_CHARSET_NAME);
+# elif defined(__clang_literal_encoding__)
+ return __te_impl(__clang_literal_encoding__);
+# else
+ return __te_impl();
+# endif
+ }
+
+# if _LIBCPP_HAS_LOCALIZATION
+ _LIBCPP_HIDDEN static __te_impl __get_locale_encoding(const char* __name);
+ _LIBCPP_HIDDEN static __te_impl __get_env_encoding();
+# if defined(_LIBCPP_WIN32API)
+ _LIBCPP_HIDDEN static __id __get_win32_acp();
+# endif
+
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_EXPORTED_FROM_ABI static __te_impl __environment();
+
+ template <__id _Id>
+ [[__nodiscard__]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static bool __environment_is() {
+ return __environment() == _Id;
+ }
+
+# endif
+
+ const __te_data* __encoding_rep_ = __text_encoding_data + 1;
+ char __name_[__max_name_length_ + 1] = {0};
+
+ _LIBCPP_HIDE_FROM_ABI static constexpr __te_data __text_encoding_data[] = {
+ {"", 1, 0, 0}, // other
+ {"", 2, 0, 0}, // unknown
+ {"US-ASCII", 3, 8, 11},
+ {"iso-ir-6", 3, 8, 10},
+ {"ANSI_X3.4-1968", 3, 14, 9},
+ {"ANSI_X3.4-1986", 3, 14, 8},
+ {"ISO_646.irv:1991", 3, 16, 7},
+ {"ISO646-US", 3, 9, 6},
+ {"us", 3, 2, 5},
+ {"IBM367", 3, 6, 4},
+ {"cp367", 3, 5, 3},
+ {"csASCII", 3, 7, 2},
+ {"ASCII", 3, 5, 1},
+ {"ISO_8859-1:1987", 4, 15, 9},
+ {"iso-ir-100", 4, 10, 8},
+ {"ISO_8859-1", 4, 10, 7},
+ {"ISO-8859-1", 4, 10, 6},
+ {"latin1", 4, 6, 5},
+ {"l1", 4, 2, 4},
+ {"IBM819", 4, 6, 3},
+ {"CP819", 4, 5, 2},
+ {"csISOLatin1", 4, 11, 1},
+ {"ISO_8859-2:1987", 5, 15, 7},
+ {"iso-ir-101", 5, 10, 6},
+ {"ISO_8859-2", 5, 10, 5},
+ {"ISO-8859-2", 5, 10, 4},
+ {"latin2", 5, 6, 3},
+ {"l2", 5, 2, 2},
+ {"csISOLatin2", 5, 11, 1},
+ {"ISO_8859-3:1988", 6, 15, 7},
+ {"iso-ir-109", 6, 10, 6},
+ {"ISO_8859-3", 6, 10, 5},
+ {"ISO-8859-3", 6, 10, 4},
+ {"latin3", 6, 6, 3},
+ {"l3", 6, 2, 2},
+ {"csISOLatin3", 6, 11, 1},
+ {"ISO_8859-4:1988", 7, 15, 7},
+ {"iso-ir-110", 7, 10, 6},
+ {"ISO_8859-4", 7, 10, 5},
+ {"ISO-8859-4", 7, 10, 4},
+ {"latin4", 7, 6, 3},
+ {"l4", 7, 2, 2},
+ {"csISOLatin4", 7, 11, 1},
+ {"ISO_8859-5:1988", 8, 15, 6},
+ {"iso-ir-144", 8, 10, 5},
+ {"ISO_8859-5", 8, 10, 4},
+ {"ISO-8859-5", 8, 10, 3},
+ {"cyrillic", 8, 8, 2},
+ {"csISOLatinCyrillic", 8, 18, 1},
+ {"ISO_8859-6:1987", 9, 15, 8},
+ {"iso-ir-127", 9, 10, 7},
+ {"ISO_8859-6", 9, 10, 6},
+ {"ISO-8859-6", 9, 10, 5},
+ {"ECMA-114", 9, 8, 4},
+ {"ASMO-708", 9, 8, 3},
+ {"arabic", 9, 6, 2},
+ {"csISOLatinArabic", 9, 16, 1},
+ {"ISO_8859-7:1987", 10, 15, 9},
+ {"iso-ir-126", 10, 10, 8},
+ {"ISO_8859-7", 10, 10, 7},
+ {"ISO-8859-7", 10, 10, 6},
+ {"ELOT_928", 10, 8, 5},
+ {"ECMA-118", 10, 8, 4},
+ {"greek", 10, 5, 3},
+ {"greek8", 10, 6, 2},
+ {"csISOLatinGreek", 10, 15, 1},
+ {"ISO_8859-8:1988", 11, 15, 6},
+ {"iso-ir-138", 11, 10, 5},
+ {"ISO_8859-8", 11, 10, 4},
+ {"ISO-8859-8", 11, 10, 3},
+ {"hebrew", 11, 6, 2},
+ {"csISOLatinHebrew", 11, 16, 1},
+ {"ISO_8859-9:1989", 12, 15, 7},
+ {"iso-ir-148", 12, 10, 6},
+ {"ISO_8859-9", 12, 10, 5},
+ {"ISO-8859-9", 12, 10, 4},
+ {"latin5", 12, 6, 3},
+ {"l5", 12, 2, 2},
+ {"csISOLatin5", 12, 11, 1},
+ {"ISO-8859-10", 13, 11, 6},
+ {"iso-ir-157", 13, 10, 5},
+ {"l6", 13, 2, 4},
+ {"ISO_8859-10:1992", 13, 16, 3},
+ {"csISOLatin6", 13, 11, 2},
+ {"latin6", 13, 6, 1},
+ {"ISO_6937-2-add", 14, 14, 3},
+ {"iso-ir-142", 14, 10, 2},
+ {"csISOTextComm", 14, 13, 1},
+ {"JIS_X0201", 15, 9, 3},
+ {"X0201", 15, 5, 2},
+ {"csHalfWidthKatakana", 15, 19, 1},
+ {"JIS_Encoding", 16, 12, 2},
+ {"csJISEncoding", 16, 13, 1},
+ {"Shift_JIS", 17, 9, 3},
+ {"MS_Kanji", 17, 8, 2},
+ {"csShiftJIS", 17, 10, 1},
+ {"Extended_UNIX_Code_Packed_Format_for_Japanese", 18, 45, 3},
+ {"csEUCPkdFmtJapanese", 18, 19, 2},
+ {"EUC-JP", 18, 6, 1},
+ {"Extended_UNIX_Code_Fixed_Width_for_Japanese", 19, 43, 2},
+ {"csEUCFixWidJapanese", 19, 19, 1},
+ {"BS_4730", 20, 7, 6},
+ {"iso-ir-4", 20, 8, 5},
+ {"ISO646-GB", 20, 9, 4},
+ {"gb", 20, 2, 3},
+ {"uk", 20, 2, 2},
+ {"csISO4UnitedKingdom", 20, 19, 1},
+ {"SEN_850200_C", 21, 12, 5},
+ {"iso-ir-11", 21, 9, 4},
+ {"ISO646-SE2", 21, 10, 3},
+ {"se2", 21, 3, 2},
+ {"csISO11SwedishForNames", 21, 22, 1},
+ {"IT", 22, 2, 4},
+ {"iso-ir-15", 22, 9, 3},
+ {"ISO646-IT", 22, 9, 2},
+ {"csISO15Italian", 22, 14, 1},
+ {"ES", 23, 2, 4},
+ {"iso-ir-17", 23, 9, 3},
+ {"ISO646-ES", 23, 9, 2},
+ {"csISO17Spanish", 23, 14, 1},
+ {"DIN_66003", 24, 9, 5},
+ {"iso-ir-21", 24, 9, 4},
+ {"de", 24, 2, 3},
+ {"ISO646-DE", 24, 9, 2},
+ {"csISO21German", 24, 13, 1},
+ {"NS_4551-1", 25, 9, 6},
+ {"iso-ir-60", 25, 9, 5},
+ {"ISO646-NO", 25, 9, 4},
+ {"no", 25, 2, 3},
+ {"csISO60DanishNorwegian", 25, 22, 2},
+ {"csISO60Norwegian1", 25, 17, 1},
+ {"NF_Z_62-010", 26, 11, 5},
+ {"iso-ir-69", 26, 9, 4},
+ {"ISO646-FR", 26, 9, 3},
+ {"fr", 26, 2, 2},
+ {"csISO69French", 26, 13, 1},
+ {"ISO-10646-UTF-1", 27, 15, 2},
+ {"csISO10646UTF1", 27, 14, 1},
+ {"ISO_646.basic:1983", 28, 18, 3},
+ {"ref", 28, 3, 2},
+ {"csISO646basic1983", 28, 17, 1},
+ {"INVARIANT", 29, 9, 2},
+ {"csINVARIANT", 29, 11, 1},
+ {"ISO_646.irv:1983", 30, 16, 4},
+ {"iso-ir-2", 30, 8, 3},
+ {"irv", 30, 3, 2},
+ {"csISO2IntlRefVersion", 30, 20, 1},
+ {"NATS-SEFI", 31, 9, 3},
+ {"iso-ir-8-1", 31, 10, 2},
+ {"csNATSSEFI", 31, 10, 1},
+ {"NATS-SEFI-ADD", 32, 13, 3},
+ {"iso-ir-8-2", 32, 10, 2},
+ {"csNATSSEFIADD", 32, 13, 1},
+ {"SEN_850200_B", 35, 12, 7},
+ {"iso-ir-10", 35, 9, 6},
+ {"FI", 35, 2, 5},
+ {"ISO646-FI", 35, 9, 4},
+ {"ISO646-SE", 35, 9, 3},
+ {"se", 35, 2, 2},
+ {"csISO10Swedish", 35, 14, 1},
+ {"KS_C_5601-1987", 36, 14, 6},
+ {"iso-ir-149", 36, 10, 5},
+ {"KS_C_5601-1989", 36, 14, 4},
+ {"KSC_5601", 36, 8, 3},
+ {"korean", 36, 6, 2},
+ {"csKSC56011987", 36, 13, 1},
+ {"ISO-2022-KR", 37, 11, 2},
+ {"csISO2022KR", 37, 11, 1},
+ {"EUC-KR", 38, 6, 2},
+ {"csEUCKR", 38, 7, 1},
+ {"ISO-2022-JP", 39, 11, 2},
+ {"csISO2022JP", 39, 11, 1},
+ {"ISO-2022-JP-2", 40, 13, 2},
+ {"csISO2022JP2", 40, 12, 1},
+ {"JIS_C6220-1969-jp", 41, 17, 6},
+ {"JIS_C6220-1969", 41, 14, 5},
+ {"iso-ir-13", 41, 9, 4},
+ {"katakana", 41, 8, 3},
+ {"x0201-7", 41, 7, 2},
+ {"csISO13JISC6220jp", 41, 17, 1},
+ {"JIS_C6220-1969-ro", 42, 17, 5},
+ {"iso-ir-14", 42, 9, 4},
+ {"jp", 42, 2, 3},
+ {"ISO646-JP", 42, 9, 2},
+ {"csISO14JISC6220ro", 42, 17, 1},
+ {"PT", 43, 2, 4},
+ {"iso-ir-16", 43, 9, 3},
+ {"ISO646-PT", 43, 9, 2},
+ {"csISO16Portuguese", 43, 17, 1},
+ {"greek7-old", 44, 10, 3},
+ {"iso-ir-18", 44, 9, 2},
+ {"csISO18Greek7Old", 44, 16, 1},
+ {"latin-greek", 45, 11, 3},
+ {"iso-ir-19", 45, 9, 2},
+ {"csISO19LatinGreek", 45, 17, 1},
+ {"NF_Z_62-010_(1973)", 46, 18, 4},
+ {"iso-ir-25", 46, 9, 3},
+ {"ISO646-FR1", 46, 10, 2},
+ {"csISO25French", 46, 13, 1},
+ {"Latin-greek-1", 47, 13, 3},
+ {"iso-ir-27", 47, 9, 2},
+ {"csISO27LatinGreek1", 47, 18, 1},
+ {"ISO_5427", 48, 8, 3},
+ {"iso-ir-37", 48, 9, 2},
+ {"csISO5427Cyrillic", 48, 17, 1},
+ {"JIS_C6226-1978", 49, 14, 3},
+ {"iso-ir-42", 49, 9, 2},
+ {"csISO42JISC62261978", 49, 19, 1},
+ {"BS_viewdata", 50, 11, 3},
+ {"iso-ir-47", 50, 9, 2},
+ {"csISO47BSViewdata", 50, 17, 1},
+ {"INIS", 51, 4, 3},
+ {"iso-ir-49", 51, 9, 2},
+ {"csISO49INIS", 51, 11, 1},
+ {"INIS-8", 52, 6, 3},
+ {"iso-ir-50", 52, 9, 2},
+ {"csISO50INIS8", 52, 12, 1},
+ {"INIS-cyrillic", 53, 13, 3},
+ {"iso-ir-51", 53, 9, 2},
+ {"csISO51INISCyrillic", 53, 19, 1},
+ {"ISO_5427:1981", 54, 13, 4},
+ {"iso-ir-54", 54, 9, 3},
+ {"ISO5427Cyrillic1981", 54, 19, 2},
+ {"csISO54271981", 54, 13, 1},
+ {"ISO_5428:1980", 55, 13, 3},
+ {"iso-ir-55", 55, 9, 2},
+ {"csISO5428Greek", 55, 14, 1},
+ {"GB_1988-80", 56, 10, 5},
+ {"iso-ir-57", 56, 9, 4},
+ {"cn", 56, 2, 3},
+ {"ISO646-CN", 56, 9, 2},
+ {"csISO57GB1988", 56, 13, 1},
+ {"GB_2312-80", 57, 10, 4},
+ {"iso-ir-58", 57, 9, 3},
+ {"chinese", 57, 7, 2},
+ {"csISO58GB231280", 57, 15, 1},
+ {"NS_4551-2", 58, 9, 5},
+ {"ISO646-NO2", 58, 10, 4},
+ {"iso-ir-61", 58, 9, 3},
+ {"no2", 58, 3, 2},
+ {"csISO61Norwegian2", 58, 17, 1},
+ {"videotex-suppl", 59, 14, 3},
+ {"iso-ir-70", 59, 9, 2},
+ {"csISO70VideotexSupp1", 59, 20, 1},
+ {"PT2", 60, 3, 4},
+ {"iso-ir-84", 60, 9, 3},
+ {"ISO646-PT2", 60, 10, 2},
+ {"csISO84Portuguese2", 60, 18, 1},
+ {"ES2", 61, 3, 4},
+ {"iso-ir-85", 61, 9, 3},
+ {"ISO646-ES2", 61, 10, 2},
+ {"csISO85Spanish2", 61, 15, 1},
+ {"MSZ_7795.3", 62, 10, 5},
+ {"iso-ir-86", 62, 9, 4},
+ {"ISO646-HU", 62, 9, 3},
+ {"hu", 62, 2, 2},
+ {"csISO86Hungarian", 62, 16, 1},
+ {"JIS_C6226-1983", 63, 14, 5},
+ {"iso-ir-87", 63, 9, 4},
+ {"x0208", 63, 5, 3},
+ {"JIS_X0208-1983", 63, 14, 2},
+ {"csISO87JISX0208", 63, 15, 1},
+ {"greek7", 64, 6, 3},
+ {"iso-ir-88", 64, 9, 2},
+ {"csISO88Greek7", 64, 13, 1},
+ {"ASMO_449", 65, 8, 5},
+ {"ISO_9036", 65, 8, 4},
+ {"arabic7", 65, 7, 3},
+ {"iso-ir-89", 65, 9, 2},
+ {"csISO89ASMO449", 65, 14, 1},
+ {"iso-ir-90", 66, 9, 2},
+ {"csISO90", 66, 7, 1},
+ {"JIS_C6229-1984-a", 67, 16, 4},
+ {"iso-ir-91", 67, 9, 3},
+ {"jp-ocr-a", 67, 8, 2},
+ {"csISO91JISC62291984a", 67, 20, 1},
+ {"JIS_C6229-1984-b", 68, 16, 5},
+ {"iso-ir-92", 68, 9, 4},
+ {"ISO646-JP-OCR-B", 68, 15, 3},
+ {"jp-ocr-b", 68, 8, 2},
+ {"csISO92JISC62991984b", 68, 20, 1},
+ {"JIS_C6229-1984-b-add", 69, 20, 4},
+ {"iso-ir-93", 69, 9, 3},
+ {"jp-ocr-b-add", 69, 12, 2},
+ {"csISO93JIS62291984badd", 69, 22, 1},
+ {"JIS_C6229-1984-hand", 70, 19, 4},
+ {"iso-ir-94", 70, 9, 3},
+ {"jp-ocr-hand", 70, 11, 2},
+ {"csISO94JIS62291984hand", 70, 22, 1},
+ {"JIS_C6229-1984-hand-add", 71, 23, 4},
+ {"iso-ir-95", 71, 9, 3},
+ {"jp-ocr-hand-add", 71, 15, 2},
+ {"csISO95JIS62291984handadd", 71, 25, 1},
+ {"JIS_C6229-1984-kana", 72, 19, 3},
+ {"iso-ir-96", 72, 9, 2},
+ {"csISO96JISC62291984kana", 72, 23, 1},
+ {"ISO_2033-1983", 73, 13, 4},
+ {"iso-ir-98", 73, 9, 3},
+ {"e13b", 73, 4, 2},
+ {"csISO2033", 73, 9, 1},
+ {"ANSI_X3.110-1983", 74, 16, 5},
+ {"iso-ir-99", 74, 9, 4},
+ {"CSA_T500-1983", 74, 13, 3},
+ {"NAPLPS", 74, 6, 2},
+ {"csISO99NAPLPS", 74, 13, 1},
+ {"T.61-7bit", 75, 9, 3},
+ {"iso-ir-102", 75, 10, 2},
+ {"csISO102T617bit", 75, 15, 1},
+ {"T.61-8bit", 76, 9, 4},
+ {"T.61", 76, 4, 3},
+ {"iso-ir-103", 76, 10, 2},
+ {"csISO103T618bit", 76, 15, 1},
+ {"ECMA-cyrillic", 77, 13, 4},
+ {"iso-ir-111", 77, 10, 3},
+ {"KOI8-E", 77, 6, 2},
+ {"csISO111ECMACyrillic", 77, 20, 1},
+ {"CSA_Z243.4-1985-1", 78, 17, 7},
+ {"iso-ir-121", 78, 10, 6},
+ {"ISO646-CA", 78, 9, 5},
+ {"csa7-1", 78, 6, 4},
+ {"csa71", 78, 5, 3},
+ {"ca", 78, 2, 2},
+ {"csISO121Canadian1", 78, 17, 1},
+ {"CSA_Z243.4-1985-2", 79, 17, 6},
+ {"iso-ir-122", 79, 10, 5},
+ {"ISO646-CA2", 79, 10, 4},
+ {"csa7-2", 79, 6, 3},
+ {"csa72", 79, 5, 2},
+ {"csISO122Canadian2", 79, 17, 1},
+ {"CSA_Z243.4-1985-gr", 80, 18, 3},
+ {"iso-ir-123", 80, 10, 2},
+ {"csISO123CSAZ24341985gr", 80, 22, 1},
+ {"ISO_8859-6-E", 81, 12, 3},
+ {"csISO88596E", 81, 11, 2},
+ {"ISO-8859-6-E", 81, 12, 1},
+ {"ISO_8859-6-I", 82, 12, 3},
+ {"csISO88596I", 82, 11, 2},
+ {"ISO-8859-6-I", 82, 12, 1},
+ {"T.101-G2", 83, 8, 3},
+ {"iso-ir-128", 83, 10, 2},
+ {"csISO128T101G2", 83, 14, 1},
+ {"ISO_8859-8-E", 84, 12, 3},
+ {"csISO88598E", 84, 11, 2},
+ {"ISO-8859-8-E", 84, 12, 1},
+ {"ISO_8859-8-I", 85, 12, 3},
+ {"csISO88598I", 85, 11, 2},
+ {"ISO-8859-8-I", 85, 12, 1},
+ {"CSN_369103", 86, 10, 3},
+ {"iso-ir-139", 86, 10, 2},
+ {"csISO139CSN369103", 86, 17, 1},
+ {"JUS_I.B1.002", 87, 12, 6},
+ {"iso-ir-141", 87, 10, 5},
+ {"ISO646-YU", 87, 9, 4},
+ {"js", 87, 2, 3},
+ {"yu", 87, 2, 2},
+ {"csISO141JUSIB1002", 87, 17, 1},
+ {"IEC_P27-1", 88, 9, 3},
+ {"iso-ir-143", 88, 10, 2},
+ {"csISO143IECP271", 88, 15, 1},
+ {"JUS_I.B1.003-serb", 89, 17, 4},
+ {"iso-ir-146", 89, 10, 3},
+ {"serbian", 89, 7, 2},
+ {"csISO146Serbian", 89, 15, 1},
+ {"JUS_I.B1.003-mac", 90, 16, 4},
+ {"macedonian", 90, 10, 3},
+ {"iso-ir-147", 90, 10, 2},
+ {"csISO147Macedonian", 90, 18, 1},
+ {"greek-ccitt", 91, 11, 4},
+ {"iso-ir-150", 91, 10, 3},
+ {"csISO150", 91, 8, 2},
+ {"csISO150GreekCCITT", 91, 18, 1},
+ {"NC_NC00-10:81", 92, 13, 5},
+ {"cuba", 92, 4, 4},
+ {"iso-ir-151", 92, 10, 3},
+ {"ISO646-CU", 92, 9, 2},
+ {"csISO151Cuba", 92, 12, 1},
+ {"ISO_6937-2-25", 93, 13, 3},
+ {"iso-ir-152", 93, 10, 2},
+ {"csISO6937Add", 93, 12, 1},
+ {"GOST_19768-74", 94, 13, 4},
+ {"ST_SEV_358-88", 94, 13, 3},
+ {"iso-ir-153", 94, 10, 2},
+ {"csISO153GOST1976874", 94, 19, 1},
+ {"ISO_8859-supp", 95, 13, 4},
+ {"iso-ir-154", 95, 10, 3},
+ {"latin1-2-5", 95, 10, 2},
+ {"csISO8859Supp", 95, 13, 1},
+ {"ISO_10367-box", 96, 13, 3},
+ {"iso-ir-155", 96, 10, 2},
+ {"csISO10367Box", 96, 13, 1},
+ {"latin-lap", 97, 9, 4},
+ {"lap", 97, 3, 3},
+ {"iso-ir-158", 97, 10, 2},
+ {"csISO158Lap", 97, 11, 1},
+ {"JIS_X0212-1990", 98, 14, 4},
+ {"x0212", 98, 5, 3},
+ {"iso-ir-159", 98, 10, 2},
+ {"csISO159JISX02121990", 98, 20, 1},
+ {"DS_2089", 99, 7, 5},
+ {"DS2089", 99, 6, 4},
+ {"ISO646-DK", 99, 9, 3},
+ {"dk", 99, 2, 2},
+ {"csISO646Danish", 99, 14, 1},
+ {"us-dk", 100, 5, 2},
+ {"csUSDK", 100, 6, 1},
+ {"dk-us", 101, 5, 2},
+ {"csDKUS", 101, 6, 1},
+ {"KSC5636", 102, 7, 3},
+ {"ISO646-KR", 102, 9, 2},
+ {"csKSC5636", 102, 9, 1},
+ {"UNICODE-1-1-UTF-7", 103, 17, 2},
+ {"csUnicode11UTF7", 103, 15, 1},
+ {"ISO-2022-CN", 104, 11, 2},
+ {"csISO2022CN", 104, 11, 1},
+ {"ISO-2022-CN-EXT", 105, 15, 2},
+ {"csISO2022CNEXT", 105, 14, 1},
+ {"UTF-8", 106, 5, 2},
+ {"csUTF8", 106, 6, 1},
+ {"ISO-8859-13", 109, 11, 2},
+ {"csISO885913", 109, 11, 1},
+ {"ISO-8859-14", 110, 11, 8},
+ {"iso-ir-199", 110, 10, 7},
+ {"ISO_8859-14:1998", 110, 16, 6},
+ {"ISO_8859-14", 110, 11, 5},
+ {"latin8", 110, 6, 4},
+ {"iso-celtic", 110, 10, 3},
+ {"l8", 110, 2, 2},
+ {"csISO885914", 110, 11, 1},
+ {"ISO-8859-15", 111, 11, 4},
+ {"ISO_8859-15", 111, 11, 3},
+ {"Latin-9", 111, 7, 2},
+ {"csISO885915", 111, 11, 1},
+ {"ISO-8859-16", 112, 11, 7},
+ {"iso-ir-226", 112, 10, 6},
+ {"ISO_8859-16:2001", 112, 16, 5},
+ {"ISO_8859-16", 112, 11, 4},
+ {"latin10", 112, 7, 3},
+ {"l10", 112, 3, 2},
+ {"csISO885916", 112, 11, 1},
+ {"GBK", 113, 3, 5},
+ {"CP936", 113, 5, 4},
+ {"MS936", 113, 5, 3},
+ {"windows-936", 113, 11, 2},
+ {"csGBK", 113, 5, 1},
+ {"GB18030", 114, 7, 2},
+ {"csGB18030", 114, 9, 1},
+ {"OSD_EBCDIC_DF04_15", 115, 18, 2},
+ {"csOSDEBCDICDF0415", 115, 17, 1},
+ {"OSD_EBCDIC_DF03_IRV", 116, 19, 2},
+ {"csOSDEBCDICDF03IRV", 116, 18, 1},
+ {"OSD_EBCDIC_DF04_1", 117, 17, 2},
+ {"csOSDEBCDICDF041", 117, 16, 1},
+ {"ISO-11548-1", 118, 11, 4},
+ {"ISO_11548-1", 118, 11, 3},
+ {"ISO_TR_11548-1", 118, 14, 2},
+ {"csISO115481", 118, 11, 1},
+ {"KZ-1048", 119, 7, 4},
+ {"STRK1048-2002", 119, 13, 3},
+ {"RK1048", 119, 6, 2},
+ {"csKZ1048", 119, 8, 1},
+ {"ISO-10646-UCS-2", 1000, 15, 2},
+ {"csUnicode", 1000, 9, 1},
+ {"ISO-10646-UCS-4", 1001, 15, 2},
+ {"csUCS4", 1001, 6, 1},
+ {"ISO-10646-UCS-Basic", 1002, 19, 2},
+ {"csUnicodeASCII", 1002, 14, 1},
+ {"ISO-10646-Unicode-Latin1", 1003, 24, 3},
+ {"csUnicodeLatin1", 1003, 15, 2},
+ {"ISO-10646", 1003, 9, 1},
+ {"ISO-10646-J-1", 1004, 13, 2},
+ {"csUnicodeJapanese", 1004, 17, 1},
+ {"ISO-Unicode-IBM-1261", 1005, 20, 2},
+ {"csUnicodeIBM1261", 1005, 16, 1},
+ {"ISO-Unicode-IBM-1268", 1006, 20, 2},
+ {"csUnicodeIBM1268", 1006, 16, 1},
+ {"ISO-Unicode-IBM-1276", 1007, 20, 2},
+ {"csUnicodeIBM1276", 1007, 16, 1},
+ {"ISO-Unicode-IBM-1264", 1008, 20, 2},
+ {"csUnicodeIBM1264", 1008, 16, 1},
+ {"ISO-Unicode-IBM-1265", 1009, 20, 2},
+ {"csUnicodeIBM1265", 1009, 16, 1},
+ {"UNICODE-1-1", 1010, 11, 2},
+ {"csUnicode11", 1010, 11, 1},
+ {"SCSU", 1011, 4, 2},
+ {"csSCSU", 1011, 6, 1},
+ {"UTF-7", 1012, 5, 2},
+ {"csUTF7", 1012, 6, 1},
+ {"UTF-16BE", 1013, 8, 2},
+ {"csUTF16BE", 1013, 9, 1},
+ {"UTF-16LE", 1014, 8, 2},
+ {"csUTF16LE", 1014, 9, 1},
+ {"UTF-16", 1015, 6, 2},
+ {"csUTF16", 1015, 7, 1},
+ {"CESU-8", 1016, 6, 3},
+ {"csCESU8", 1016, 7, 2},
+ {"csCESU-8", 1016, 8, 1},
+ {"UTF-32", 1017, 6, 2},
+ {"csUTF32", 1017, 7, 1},
+ {"UTF-32BE", 1018, 8, 2},
+ {"csUTF32BE", 1018, 9, 1},
+ {"UTF-32LE", 1019, 8, 2},
+ {"csUTF32LE", 1019, 9, 1},
+ {"BOCU-1", 1020, 6, 3},
+ {"csBOCU1", 1020, 7, 2},
+ {"csBOCU-1", 1020, 8, 1},
+ {"UTF-7-IMAP", 1021, 10, 2},
+ {"csUTF7IMAP", 1021, 10, 1},
+ {"ISO-8859-1-Windows-3.0-Latin-1", 2000, 30, 2},
+ {"csWindows30Latin1", 2000, 17, 1},
+ {"ISO-8859-1-Windows-3.1-Latin-1", 2001, 30, 2},
+ {"csWindows31Latin1", 2001, 17, 1},
+ {"ISO-8859-2-Windows-Latin-2", 2002, 26, 2},
+ {"csWindows31Latin2", 2002, 17, 1},
+ {"ISO-8859-9-Windows-Latin-5", 2003, 26, 2},
+ {"csWindows31Latin5", 2003, 17, 1},
+ {"hp-roman8", 2004, 9, 4},
+ {"roman8", 2004, 6, 3},
+ {"r8", 2004, 2, 2},
+ {"csHPRoman8", 2004, 10, 1},
+ {"Adobe-Standard-Encoding", 2005, 23, 2},
+ {"csAdobeStandardEncoding", 2005, 23, 1},
+ {"Ventura-US", 2006, 10, 2},
+ {"csVenturaUS", 2006, 11, 1},
+ {"Ventura-International", 2007, 21, 2},
+ {"csVenturaInternational", 2007, 22, 1},
+ {"DEC-MCS", 2008, 7, 3},
+ {"dec", 2008, 3, 2},
+ {"csDECMCS", 2008, 8, 1},
+ {"IBM850", 2009, 6, 4},
+ {"cp850", 2009, 5, 3},
+ {"850", 2009, 3, 2},
+ {"csPC850Multilingual", 2009, 19, 1},
+ {"IBM852", 2010, 6, 4},
+ {"cp852", 2010, 5, 3},
+ {"852", 2010, 3, 2},
+ {"csPCp852", 2010, 8, 1},
+ {"IBM437", 2011, 6, 4},
+ {"cp437", 2011, 5, 3},
+ {"437", 2011, 3, 2},
+ {"csPC8CodePage437", 2011, 16, 1},
+ {"PC8-Danish-Norwegian", 2012, 20, 2},
+ {"csPC8DanishNorwegian", 2012, 20, 1},
+ {"IBM862", 2013, 6, 4},
+ {"cp862", 2013, 5, 3},
+ {"862", 2013, 3, 2},
+ {"csPC862LatinHebrew", 2013, 18, 1},
+ {"PC8-Turkish", 2014, 11, 2},
+ {"csPC8Turkish", 2014, 12, 1},
+ {"IBM-Symbols", 2015, 11, 2},
+ {"csIBMSymbols", 2015, 12, 1},
+ {"IBM-Thai", 2016, 8, 2},
+ {"csIBMThai", 2016, 9, 1},
+ {"HP-Legal", 2017, 8, 2},
+ {"csHPLegal", 2017, 9, 1},
+ {"HP-Pi-font", 2018, 10, 2},
+ {"csHPPiFont", 2018, 10, 1},
+ {"HP-Math8", 2019, 8, 2},
+ {"csHPMath8", 2019, 9, 1},
+ {"Adobe-Symbol-Encoding", 2020, 21, 2},
+ {"csHPPSMath", 2020, 10, 1},
+ {"HP-DeskTop", 2021, 10, 2},
+ {"csHPDesktop", 2021, 11, 1},
+ {"Ventura-Math", 2022, 12, 2},
+ {"csVenturaMath", 2022, 13, 1},
+ {"Microsoft-Publishing", 2023, 20, 2},
+ {"csMicrosoftPublishing", 2023, 21, 1},
+ {"Windows-31J", 2024, 11, 2},
+ {"csWindows31J", 2024, 12, 1},
+ {"GB2312", 2025, 6, 2},
+ {"csGB2312", 2025, 8, 1},
+ {"Big5", 2026, 4, 2},
+ {"csBig5", 2026, 6, 1},
+ {"macintosh", 2027, 9, 3},
+ {"mac", 2027, 3, 2},
+ {"csMacintosh", 2027, 11, 1},
+ {"IBM037", 2028, 6, 7},
+ {"cp037", 2028, 5, 6},
+ {"ebcdic-cp-us", 2028, 12, 5},
+ {"ebcdic-cp-ca", 2028, 12, 4},
+ {"ebcdic-cp-wt", 2028, 12, 3},
+ {"ebcdic-cp-nl", 2028, 12, 2},
+ {"csIBM037", 2028, 8, 1},
+ {"IBM038", 2029, 6, 4},
+ {"EBCDIC-INT", 2029, 10, 3},
+ {"cp038", 2029, 5, 2},
+ {"csIBM038", 2029, 8, 1},
+ {"IBM273", 2030, 6, 3},
+ {"CP273", 2030, 5, 2},
+ {"csIBM273", 2030, 8, 1},
+ {"IBM274", 2031, 6, 4},
+ {"EBCDIC-BE", 2031, 9, 3},
+ {"CP274", 2031, 5, 2},
+ {"csIBM274", 2031, 8, 1},
+ {"IBM275", 2032, 6, 4},
+ {"EBCDIC-BR", 2032, 9, 3},
+ {"cp275", 2032, 5, 2},
+ {"csIBM275", 2032, 8, 1},
+ {"IBM277", 2033, 6, 4},
+ {"EBCDIC-CP-DK", 2033, 12, 3},
+ {"EBCDIC-CP-NO", 2033, 12, 2},
+ {"csIBM277", 2033, 8, 1},
+ {"IBM278", 2034, 6, 5},
+ {"CP278", 2034, 5, 4},
+ {"ebcdic-cp-fi", 2034, 12, 3},
+ {"ebcdic-cp-se", 2034, 12, 2},
+ {"csIBM278", 2034, 8, 1},
+ {"IBM280", 2035, 6, 4},
+ {"CP280", 2035, 5, 3},
+ {"ebcdic-cp-it", 2035, 12, 2},
+ {"csIBM280", 2035, 8, 1},
+ {"IBM281", 2036, 6, 4},
+ {"EBCDIC-JP-E", 2036, 11, 3},
+ {"cp281", 2036, 5, 2},
+ {"csIBM281", 2036, 8, 1},
+ {"IBM284", 2037, 6, 4},
+ {"CP284", 2037, 5, 3},
+ {"ebcdic-cp-es", 2037, 12, 2},
+ {"csIBM284", 2037, 8, 1},
+ {"IBM285", 2038, 6, 4},
+ {"CP285", 2038, 5, 3},
+ {"ebcdic-cp-gb", 2038, 12, 2},
+ {"csIBM285", 2038, 8, 1},
+ {"IBM290", 2039, 6, 4},
+ {"cp290", 2039, 5, 3},
+ {"EBCDIC-JP-kana", 2039, 14, 2},
+ {"csIBM290", 2039, 8, 1},
+ {"IBM297", 2040, 6, 4},
+ {"cp297", 2040, 5, 3},
+ {"ebcdic-cp-fr", 2040, 12, 2},
+ {"csIBM297", 2040, 8, 1},
+ {"IBM420", 2041, 6, 4},
+ {"cp420", 2041, 5, 3},
+ {"ebcdic-cp-ar1", 2041, 13, 2},
+ {"csIBM420", 2041, 8, 1},
+ {"IBM423", 2042, 6, 4},
+ {"cp423", 2042, 5, 3},
+ {"ebcdic-cp-gr", 2042, 12, 2},
+ {"csIBM423", 2042, 8, 1},
+ {"IBM424", 2043, 6, 4},
+ {"cp424", 2043, 5, 3},
+ {"ebcdic-cp-he", 2043, 12, 2},
+ {"csIBM424", 2043, 8, 1},
+ {"IBM500", 2044, 6, 5},
+ {"CP500", 2044, 5, 4},
+ {"ebcdic-cp-be", 2044, 12, 3},
+ {"ebcdic-cp-ch", 2044, 12, 2},
+ {"csIBM500", 2044, 8, 1},
+ {"IBM851", 2045, 6, 4},
+ {"cp851", 2045, 5, 3},
+ {"851", 2045, 3, 2},
+ {"csIBM851", 2045, 8, 1},
+ {"IBM855", 2046, 6, 4},
+ {"cp855", 2046, 5, 3},
+ {"855", 2046, 3, 2},
+ {"csIBM855", 2046, 8, 1},
+ {"IBM857", 2047, 6, 4},
+ {"cp857", 2047, 5, 3},
+ {"857", 2047, 3, 2},
+ {"csIBM857", 2047, 8, 1},
+ {"IBM860", 2048, 6, 4},
+ {"cp860", 2048, 5, 3},
+ {"860", 2048, 3, 2},
+ {"csIBM860", 2048, 8, 1},
+ {"IBM861", 2049, 6, 5},
+ {"cp861", 2049, 5, 4},
+ {"861", 2049, 3, 3},
+ {"cp-is", 2049, 5, 2},
+ {"csIBM861", 2049, 8, 1},
+ {"IBM863", 2050, 6, 4},
+ {"cp863", 2050, 5, 3},
+ {"863", 2050, 3, 2},
+ {"csIBM863", 2050, 8, 1},
+ {"IBM864", 2051, 6, 3},
+ {"cp864", 2051, 5, 2},
+ {"csIBM864", 2051, 8, 1},
+ {"IBM865", 2052, 6, 4},
+ {"cp865", 2052, 5, 3},
+ {"865", 2052, 3, 2},
+ {"csIBM865", 2052, 8, 1},
+ {"IBM868", 2053, 6, 4},
+ {"CP868", 2053, 5, 3},
+ {"cp-ar", 2053, 5, 2},
+ {"csIBM868", 2053, 8, 1},
+ {"IBM869", 2054, 6, 5},
+ {"cp869", 2054, 5, 4},
+ {"869", 2054, 3, 3},
+ {"cp-gr", 2054, 5, 2},
+ {"csIBM869", 2054, 8, 1},
+ {"IBM870", 2055, 6, 5},
+ {"CP870", 2055, 5, 4},
+ {"ebcdic-cp-roece", 2055, 15, 3},
+ {"ebcdic-cp-yu", 2055, 12, 2},
+ {"csIBM870", 2055, 8, 1},
+ {"IBM871", 2056, 6, 4},
+ {"CP871", 2056, 5, 3},
+ {"ebcdic-cp-is", 2056, 12, 2},
+ {"csIBM871", 2056, 8, 1},
+ {"IBM880", 2057, 6, 4},
+ {"cp880", 2057, 5, 3},
+ {"EBCDIC-Cyrillic", 2057, 15, 2},
+ {"csIBM880", 2057, 8, 1},
+ {"IBM891", 2058, 6, 3},
+ {"cp891", 2058, 5, 2},
+ {"csIBM891", 2058, 8, 1},
+ {"IBM903", 2059, 6, 3},
+ {"cp903", 2059, 5, 2},
+ {"csIBM903", 2059, 8, 1},
+ {"IBM904", 2060, 6, 4},
+ {"cp904", 2060, 5, 3},
+ {"904", 2060, 3, 2},
+ {"csIBBM904", 2060, 9, 1},
+ {"IBM905", 2061, 6, 4},
+ {"CP905", 2061, 5, 3},
+ {"ebcdic-cp-tr", 2061, 12, 2},
+ {"csIBM905", 2061, 8, 1},
+ {"IBM918", 2062, 6, 4},
+ {"CP918", 2062, 5, 3},
+ {"ebcdic-cp-ar2", 2062, 13, 2},
+ {"csIBM918", 2062, 8, 1},
+ {"IBM1026", 2063, 7, 3},
+ {"CP1026", 2063, 6, 2},
+ {"csIBM1026", 2063, 9, 1},
+ {"EBCDIC-AT-DE", 2064, 12, 2},
+ {"csIBMEBCDICATDE", 2064, 15, 1},
+ {"EBCDIC-AT-DE-A", 2065, 14, 2},
+ {"csEBCDICATDEA", 2065, 13, 1},
+ {"EBCDIC-CA-FR", 2066, 12, 2},
+ {"csEBCDICCAFR", 2066, 12, 1},
+ {"EBCDIC-DK-NO", 2067, 12, 2},
+ {"csEBCDICDKNO", 2067, 12, 1},
+ {"EBCDIC-DK-NO-A", 2068, 14, 2},
+ {"csEBCDICDKNOA", 2068, 13, 1},
+ {"EBCDIC-FI-SE", 2069, 12, 2},
+ {"csEBCDICFISE", 2069, 12, 1},
+ {"EBCDIC-FI-SE-A", 2070, 14, 2},
+ {"csEBCDICFISEA", 2070, 13, 1},
+ {"EBCDIC-FR", 2071, 9, 2},
+ {"csEBCDICFR", 2071, 10, 1},
+ {"EBCDIC-IT", 2072, 9, 2},
+ {"csEBCDICIT", 2072, 10, 1},
+ {"EBCDIC-PT", 2073, 9, 2},
+ {"csEBCDICPT", 2073, 10, 1},
+ {"EBCDIC-ES", 2074, 9, 2},
+ {"csEBCDICES", 2074, 10, 1},
+ {"EBCDIC-ES-A", 2075, 11, 2},
+ {"csEBCDICESA", 2075, 11, 1},
+ {"EBCDIC-ES-S", 2076, 11, 2},
+ {"csEBCDICESS", 2076, 11, 1},
+ {"EBCDIC-UK", 2077, 9, 2},
+ {"csEBCDICUK", 2077, 10, 1},
+ {"EBCDIC-US", 2078, 9, 2},
+ {"csEBCDICUS", 2078, 10, 1},
+ {"UNKNOWN-8BIT", 2079, 12, 2},
+ {"csUnknown8BiT", 2079, 13, 1},
+ {"MNEMONIC", 2080, 8, 2},
+ {"csMnemonic", 2080, 10, 1},
+ {"MNEM", 2081, 4, 2},
+ {"csMnem", 2081, 6, 1},
+ {"VISCII", 2082, 6, 2},
+ {"csVISCII", 2082, 8, 1},
+ {"VIQR", 2083, 4, 2},
+ {"csVIQR", 2083, 6, 1},
+ {"KOI8-R", 2084, 6, 2},
+ {"csKOI8R", 2084, 7, 1},
+ {"HZ-GB-2312", 2085, 10, 1},
+ {"IBM866", 2086, 6, 4},
+ {"cp866", 2086, 5, 3},
+ {"866", 2086, 3, 2},
+ {"csIBM866", 2086, 8, 1},
+ {"IBM775", 2087, 6, 3},
+ {"cp775", 2087, 5, 2},
+ {"csPC775Baltic", 2087, 13, 1},
+ {"KOI8-U", 2088, 6, 2},
+ {"csKOI8U", 2088, 7, 1},
+ {"IBM00858", 2089, 8, 5},
+ {"CCSID00858", 2089, 10, 4},
+ {"CP00858", 2089, 7, 3},
+ {"PC-Multilingual-850+euro", 2089, 24, 2},
+ {"csIBM00858", 2089, 10, 1},
+ {"IBM00924", 2090, 8, 5},
+ {"CCSID00924", 2090, 10, 4},
+ {"CP00924", 2090, 7, 3},
+ {"ebcdic-Latin9--euro", 2090, 19, 2},
+ {"csIBM00924", 2090, 10, 1},
+ {"IBM01140", 2091, 8, 5},
+ {"CCSID01140", 2091, 10, 4},
+ {"CP01140", 2091, 7, 3},
+ {"ebcdic-us-37+euro", 2091, 17, 2},
+ {"csIBM01140", 2091, 10, 1},
+ {"IBM01141", 2092, 8, 5},
+ {"CCSID01141", 2092, 10, 4},
+ {"CP01141", 2092, 7, 3},
+ {"ebcdic-de-273+euro", 2092, 18, 2},
+ {"csIBM01141", 2092, 10, 1},
+ {"IBM01142", 2093, 8, 6},
+ {"CCSID01142", 2093, 10, 5},
+ {"CP01142", 2093, 7, 4},
+ {"ebcdic-dk-277+euro", 2093, 18, 3},
+ {"ebcdic-no-277+euro", 2093, 18, 2},
+ {"csIBM01142", 2093, 10, 1},
+ {"IBM01143", 2094, 8, 6},
+ {"CCSID01143", 2094, 10, 5},
+ {"CP01143", 2094, 7, 4},
+ {"ebcdic-fi-278+euro", 2094, 18, 3},
+ {"ebcdic-se-278+euro", 2094, 18, 2},
+ {"csIBM01143", 2094, 10, 1},
+ {"IBM01144", 2095, 8, 5},
+ {"CCSID01144", 2095, 10, 4},
+ {"CP01144", 2095, 7, 3},
+ {"ebcdic-it-280+euro", 2095, 18, 2},
+ {"csIBM01144", 2095, 10, 1},
+ {"IBM01145", 2096, 8, 5},
+ {"CCSID01145", 2096, 10, 4},
+ {"CP01145", 2096, 7, 3},
+ {"ebcdic-es-284+euro", 2096, 18, 2},
+ {"csIBM01145", 2096, 10, 1},
+ {"IBM01146", 2097, 8, 5},
+ {"CCSID01146", 2097, 10, 4},
+ {"CP01146", 2097, 7, 3},
+ {"ebcdic-gb-285+euro", 2097, 18, 2},
+ {"csIBM01146", 2097, 10, 1},
+ {"IBM01147", 2098, 8, 5},
+ {"CCSID01147", 2098, 10, 4},
+ {"CP01147", 2098, 7, 3},
+ {"ebcdic-fr-297+euro", 2098, 18, 2},
+ {"csIBM01147", 2098, 10, 1},
+ {"IBM01148", 2099, 8, 5},
+ {"CCSID01148", 2099, 10, 4},
+ {"CP01148", 2099, 7, 3},
+ {"ebcdic-international-500+euro", 2099, 29, 2},
+ {"csIBM01148", 2099, 10, 1},
+ {"IBM01149", 2100, 8, 5},
+ {"CCSID01149", 2100, 10, 4},
+ {"CP01149", 2100, 7, 3},
+ {"ebcdic-is-871+euro", 2100, 18, 2},
+ {"csIBM01149", 2100, 10, 1},
+ {"Big5-HKSCS", 2101, 10, 2},
+ {"csBig5HKSCS", 2101, 11, 1},
+ {"IBM1047", 2102, 7, 3},
+ {"IBM-1047", 2102, 8, 2},
+ {"csIBM1047", 2102, 9, 1},
+ {"PTCP154", 2103, 7, 5},
+ {"csPTCP154", 2103, 9, 4},
+ {"PT154", 2103, 5, 3},
+ {"CP154", 2103, 5, 2},
+ {"Cyrillic-Asian", 2103, 14, 1},
+ {"Amiga-1251", 2104, 10, 5},
+ {"Ami1251", 2104, 7, 4},
+ {"Amiga1251", 2104, 9, 3},
+ {"Ami-1251", 2104, 8, 2},
+ {"csAmiga1251", 2104, 11, 1},
+ {"KOI7-switched", 2105, 13, 2},
+ {"csKOI7switched", 2105, 14, 1},
+ {"BRF", 2106, 3, 2},
+ {"csBRF", 2106, 5, 1},
+ {"TSCII", 2107, 5, 2},
+ {"csTSCII", 2107, 7, 1},
+ {"CP51932", 2108, 7, 2},
+ {"csCP51932", 2108, 9, 1},
+ {"windows-874", 2109, 11, 2},
+ {"cswindows874", 2109, 12, 1},
+ {"windows-1250", 2250, 12, 2},
+ {"cswindows1250", 2250, 13, 1},
+ {"windows-1251", 2251, 12, 2},
+ {"cswindows1251", 2251, 13, 1},
+ {"windows-1252", 2252, 12, 2},
+ {"cswindows1252", 2252, 13, 1},
+ {"windows-1253", 2253, 12, 2},
+ {"cswindows1253", 2253, 13, 1},
+ {"windows-1254", 2254, 12, 2},
+ {"cswindows1254", 2254, 13, 1},
+ {"windows-1255", 2255, 12, 2},
+ {"cswindows1255", 2255, 13, 1},
+ {"windows-1256", 2256, 12, 2},
+ {"cswindows1256", 2256, 13, 1},
+ {"windows-1257", 2257, 12, 2},
+ {"cswindows1257", 2257, 13, 1},
+ {"windows-1258", 2258, 12, 2},
+ {"cswindows1258", 2258, 13, 1},
+ {"TIS-620", 2259, 7, 3},
+ {"csTIS620", 2259, 8, 2},
+ {"ISO-8859-11", 2259, 11, 1},
+ {"CP50220", 2260, 7, 2},
+ {"csCP50220", 2260, 9, 1}};
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP__TEXT_ENCODING_TE_IMPL_H
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index b622680a4920b..953f10f996f55 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2099,6 +2099,13 @@ module std [system] {
export *
}
+ module text_encoding {
+ module text_encoding { header "__text_encoding/te_impl.h" }
+
+ header "text_encoding"
+ export *
+ }
+
module thread {
module formatter { header "__thread/formatter.h" }
module id { header "__thread/id.h" }
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
new file mode 100644
index 0000000000000..45962b3cc7438
--- /dev/null
+++ b/libcxx/include/text_encoding
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_TEXT_ENCODING
+#define _LIBCPP_TEXT_ENCODING
+
+/* text_encoding synopsis
+namespace std {
+
+struct text_encoding;
+
+// [text.encoding.hash], hash support
+template<class T> struct hash;
+template<> struct hash<text_encoding>;
+
+struct text_encoding
+{
+ static constexpr size_t max_name_length = 63;
+
+ // [text.encoding.id], enumeration text_encoding::id
+ enum class id : int_least32_t {
+ see below
+ };
+ using enum id;
+
+ constexpr text_encoding() = default;
+ constexpr explicit text_encoding(string_view enc) noexcept;
+ constexpr text_encoding(id i) noexcept;
+
+ constexpr id mib() const noexcept;
+ constexpr const char* name() const noexcept;
+
+ // [text.encoding.aliases], class text_encoding::aliases_view
+ // struct aliases_view;
+ constexpr aliases_view aliases() const noexcept;
+
+ friend constexpr bool operator==(const text_encoding& a,
+ const text_encoding& b) noexcept;
+ friend constexpr bool operator==(const text_encoding& encoding, id i) noexcept;
+
+ static consteval text_encoding literal() noexcept;
+ static text_encoding environment();
+ template<id i> static bool environment_is();
+
+ private:
+ id mib_ = id::unknown; // exposition only
+ char name_[max_name_length + 1] = {0}; // exposition only
+ static constexpr bool comp-name(string_view a, string_view b); // exposition only
+};
+}
+
+*/
+
+#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+# include <__cxx03/__config>
+#else
+
+# include <__config>
+# include <__functional/hash.h>
+# include <__ranges/enable_borrowed_range.h>
+# include <__text_encoding/te_impl.h>
+# include <string_view>
+# include <version>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+# if _LIBCPP_STD_VER >= 26
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct text_encoding {
+private:
+ __te_impl __impl_;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit text_encoding(__te_impl&& __imp) : __impl_(__imp) {}
+
+public:
+ static constexpr auto max_name_length = __te_impl::__max_name_length_;
+ using id = __te_impl::__id;
+ using aliases_view = __te_impl::__aliases_view;
+ using enum id;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr text_encoding() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit text_encoding(string_view __enc) noexcept : __impl_(__enc) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr text_encoding(id __i) noexcept : __impl_(__i) {}
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr id mib() const noexcept { return __impl_.__mib(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const char* name() const noexcept { return __impl_.__name(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr aliases_view aliases() const { return __impl_.__aliases(); }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const text_encoding& __a, const text_encoding& __b) noexcept {
+ return __a.__impl_ == __b.__impl_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const text_encoding& __enc, const id __i) noexcept {
+ return __enc.__impl_ == __i;
+ }
+
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static consteval text_encoding literal() noexcept {
+ return text_encoding(__te_impl::__literal());
+ }
+# if _LIBCPP_HAS_LOCALIZATION && !defined(__ANDROID__)
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static text_encoding environment() {
+ return text_encoding(__te_impl::__environment());
+ };
+
+ template <id _Id>
+ [[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static bool environment_is() {
+ return __te_impl::__environment_is<_Id>();
+ }
+# else
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static text_encoding environment() = delete;
+
+ template <id _Id>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool environment_is() = delete;
+# endif
+};
+
+template <>
+struct hash<text_encoding> {
+ size_t operator()(const text_encoding& __enc) const noexcept {
+ return std::hash<std::text_encoding::id>()(__enc.mib());
+ }
+};
+
+template <>
+inline constexpr bool ranges::enable_borrowed_range<text_encoding::aliases_view> = true;
+
+_LIBCPP_END_NAMESPACE_STD
+
+# endif // _LIBCPP_STD_VER >= 26
+
+#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+
+#endif // _LIBCPP_TEXT_ENCODING
diff --git a/libcxx/include/version b/libcxx/include/version
index 7d77677a012ce..f64da3a604dc7 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -619,7 +619,7 @@ __cpp_lib_void_t 201411L <type_traits>
# undef __cpp_lib_string_view
# define __cpp_lib_string_view 202403L
// # define __cpp_lib_submdspan 202306L
-// # define __cpp_lib_text_encoding 202306L
+# define __cpp_lib_text_encoding 202306L
# undef __cpp_lib_to_chars
// # define __cpp_lib_to_chars 202306L
// # define __cpp_lib_to_string 202306L
diff --git a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist
index da1e340b1d4aa..4180bc584a3f3 100644
--- a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -1921,6 +1921,7 @@
{'is_defined': True, 'name': '__ZNSt3__19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '__ZNSt3__19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '__ZNSt3__19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '__ZNSt3__19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '__ZNSt3__19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '__ZNSt3__19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '__ZNSt3__19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
index abbcc5c14b544..562ab477169a7 100644
--- a/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/i686-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -1558,6 +1558,7 @@
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '_ZNSt6__ndk19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
index 1224f51e17687..0785d602473e3 100644
--- a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -850,6 +850,7 @@
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_f', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_fNS_12chars_formatE', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_fNS_12chars_formatEi', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19__te_impl13__environmentEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD0Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD1Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD2Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
index 934505b18a64b..6730f90d8c32f 100644
--- a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -850,6 +850,7 @@
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_f', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_fNS_12chars_formatE', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__18to_charsEPcS0_fNS_12chars_formatEi', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19__te_impl13__environmentEv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD0Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD1Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'EXP', 'is_defined': True, 'name': '_ZNSt3__19strstreamD2Ev', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
index 6c437f9adea48..0bbf013474c0c 100644
--- a/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-linux-android21.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -1558,6 +1558,7 @@
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '_ZNSt6__ndk19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt6__ndk19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
index 017b6d33c4262..f60e7be8b442a 100644
--- a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -1571,6 +1571,7 @@
{'is_defined': True, 'name': '_ZNSt3__19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '_ZNSt3__19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
index 363fa42975b8e..ebfcebde7f5c6 100644
--- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -1570,6 +1570,7 @@
{'is_defined': True, 'name': '_ZNSt3__19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '_ZNSt3__19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
index cf4668a2dea21..55fe24a03ce00 100644
--- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
@@ -1541,6 +1541,7 @@
{'is_defined': True, 'name': '_ZNSt3__19__num_putIcE23__widen_and_group_floatEPcS2_S2_S2_RS2_S3_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE21__widen_and_group_intEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19__num_putIwE23__widen_and_group_floatEPcS2_S2_PwRS3_S4_RKNS_6localeE', 'type': 'FUNC'}
+{'is_defined': True, 'name': '_ZNSt3__19__te_impl13__environmentEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEE7copyfmtERKS3_', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED0Ev', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNSt3__19basic_iosIcNS_11char_traitsIcEEED1Ev', 'type': 'FUNC'}
diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in
index dd7385bf33a42..ab08125c4c4e4 100644
--- a/libcxx/modules/std.compat.cppm.in
+++ b/libcxx/modules/std.compat.cppm.in
@@ -75,9 +75,6 @@ module;
# if __has_include(<stdfloat>)
# error "please update the header information for <stdfloat> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<stdfloat>)
-# if __has_include(<text_encoding>)
-# error "please update the header information for <text_encoding> in headers_not_available in utils/libcxx/header_information.py"
-# endif // __has_include(<text_encoding>)
#endif // _WIN32
export module std.compat;
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
index 984b18321923c..08a39f64bc1e3 100644
--- a/libcxx/modules/std.cppm.in
+++ b/libcxx/modules/std.cppm.in
@@ -110,6 +110,7 @@ module;
#include <strstream>
#include <syncstream>
#include <system_error>
+#include <text_encoding>
#include <thread>
#include <tuple>
#include <type_traits>
@@ -159,9 +160,6 @@ module;
# if __has_include(<stdfloat>)
# error "please update the header information for <stdfloat> in headers_not_available in utils/libcxx/header_information.py"
# endif // __has_include(<stdfloat>)
-# if __has_include(<text_encoding>)
-# error "please update the header information for <text_encoding> in headers_not_available in utils/libcxx/header_information.py"
-# endif // __has_include(<text_encoding>)
#endif // _WIN32
export module std;
diff --git a/libcxx/modules/std/text_encoding.inc b/libcxx/modules/std/text_encoding.inc
index 6d5e3f1d68c60..8ad1e7bfced43 100644
--- a/libcxx/modules/std/text_encoding.inc
+++ b/libcxx/modules/std/text_encoding.inc
@@ -8,12 +8,11 @@
//===----------------------------------------------------------------------===//
export namespace std {
-#if 0
-# if _LIBCPP_STD_VER >= 23
- using std::text_encoding;
-
- // hash support
+#if _LIBCPP_STD_VER >= 26
using std::hash;
-# endif // _LIBCPP_STD_VER >= 23
+ namespace ranges {
+ using std::ranges::enable_borrowed_range;
+ }
+ using std::text_encoding;
#endif
} // namespace std
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index ebd6141902ef7..18fc4282d5430 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -92,6 +92,7 @@ if (LIBCXX_ENABLE_LOCALIZATION)
ostream.cpp
regex.cpp
strstream.cpp
+ text_encoding.cpp
)
endif()
diff --git a/libcxx/src/text_encoding.cpp b/libcxx/src/text_encoding.cpp
new file mode 100644
index 0000000000000..8c5a1889c4799
--- /dev/null
+++ b/libcxx/src/text_encoding.cpp
@@ -0,0 +1,256 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include <__config>
+#include <__text_encoding/te_impl.h>
+
+#if defined(_LIBCPP_WIN32API)
+# include <windows.h>
+#else
+# include <__locale_dir/locale_base_api.h>
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if defined(_LIBCPP_WIN32API)
+_LIBCPP_HIDDEN __te_impl::__id __te_impl::__get_win32_acp() {
+ switch (GetACP()) {
+ case 037:
+ return __te_impl::__id::IBM037;
+ case 437:
+ return __te_impl::__id::PC8CodePage437;
+ case 500:
+ return __te_impl::__id::IBM500;
+ case 708:
+ return __te_impl::__id::ISOLatinArabic;
+ case 709:
+ return __te_impl::__id::ISO89ASMO449;
+ case 775:
+ return __te_impl::__id::PC775Baltic;
+ case 850:
+ return __te_impl::__id::PC850Multilingual;
+ case 852:
+ return __te_impl::__id::PCp852;
+ case 855:
+ return __te_impl::__id::IBM855;
+ case 857:
+ return __te_impl::__id::IBM857;
+ case 858:
+ return __te_impl::__id::IBM00858;
+ case 860:
+ return __te_impl::__id::IBM860;
+ case 861:
+ return __te_impl::__id::IBM861;
+ case 862:
+ return __te_impl::__id::PC862LatinHebrew;
+ case 863:
+ return __te_impl::__id::IBM863;
+ case 864:
+ return __te_impl::__id::IBM864;
+ case 865:
+ return __te_impl::__id::IBM865;
+ case 866:
+ return __te_impl::__id::IBM866;
+ case 869:
+ return __te_impl::__id::IBM869;
+ case 870:
+ return __te_impl::__id::IBM870;
+ case 874:
+ return __te_impl::__id::windows874;
+ case 932:
+ return __te_impl::__id::ShiftJIS;
+ case 936:
+ return __te_impl::__id::GB2312;
+ case 949:
+ return __te_impl::__id::KSC56011987;
+ case 950:
+ return __te_impl::__id::Big5;
+ case 1026:
+ return __te_impl::__id::IBM1026;
+ case 1047:
+ return __te_impl::__id::IBM1047;
+ case 1140:
+ return __te_impl::__id::IBM01140;
+ case 1141:
+ return __te_impl::__id::IBM01141;
+ case 1142:
+ return __te_impl::__id::IBM01142;
+ case 1143:
+ return __te_impl::__id::IBM01143;
+ case 1144:
+ return __te_impl::__id::IBM01144;
+ case 1145:
+ return __te_impl::__id::IBM01145;
+ case 1146:
+ return __te_impl::__id::IBM01146;
+ case 1147:
+ return __te_impl::__id::IBM01147;
+ case 1148:
+ return __te_impl::__id::IBM01148;
+ case 1149:
+ return __te_impl::__id::IBM01149;
+ case 1200:
+ return __te_impl::__id::UTF16LE;
+ case 1201:
+ return __te_impl::__id::UTF16BE;
+ case 1250:
+ return __te_impl::__id::windows1250;
+ case 1251:
+ return __te_impl::__id::windows1251;
+ case 1252:
+ return __te_impl::__id::windows1252;
+ case 1253:
+ return __te_impl::__id::windows1253;
+ case 1254:
+ return __te_impl::__id::windows1254;
+ case 1255:
+ return __te_impl::__id::windows1255;
+ case 1256:
+ return __te_impl::__id::windows1256;
+ case 1257:
+ return __te_impl::__id::windows1257;
+ case 1258:
+ return __te_impl::__id::windows1258;
+ case 10000:
+ return __te_impl::__id::Macintosh;
+ case 12000:
+ return __te_impl::__id::UTF32LE;
+ case 12001:
+ return __te_impl::__id::UTF32BE;
+ case 20127:
+ return __te_impl::__id::ASCII;
+ case 20273:
+ return __te_impl::__id::IBM273;
+ case 20277:
+ return __te_impl::__id::IBM277;
+ case 20278:
+ return __te_impl::__id::IBM278;
+ case 20280:
+ return __te_impl::__id::IBM280;
+ case 20284:
+ return __te_impl::__id::IBM284;
+ case 20285:
+ return __te_impl::__id::IBM285;
+ case 20290:
+ return __te_impl::__id::IBM290;
+ case 20297:
+ return __te_impl::__id::IBM297;
+ case 20420:
+ return __te_impl::__id::IBM420;
+ case 20423:
+ return __te_impl::__id::IBM423;
+ case 20424:
+ return __te_impl::__id::IBM424;
+ case 20838:
+ return __te_impl::__id::IBMThai;
+ case 20866:
+ return __te_impl::__id::KOI8R;
+ case 20871:
+ return __te_impl::__id::IBM871;
+ case 20880:
+ return __te_impl::__id::IBM880;
+ case 20905:
+ return __te_impl::__id::IBM905;
+ case 20924:
+ return __te_impl::__id::IBM00924;
+ case 20932:
+ return __te_impl::__id::EUCPkdFmtJapanese;
+ case 21866:
+ return __te_impl::__id::KOI8U;
+ case 28591:
+ return __te_impl::__id::ISOLatin1;
+ case 28592:
+ return __te_impl::__id::ISOLatin2;
+ case 28593:
+ return __te_impl::__id::ISOLatin3;
+ case 28594:
+ return __te_impl::__id::ISOLatin4;
+ case 28595:
+ return __te_impl::__id::ISOLatin5;
+ case 28596:
+ return __te_impl::__id::ISOLatin6;
+ case 28597:
+ return __te_impl::__id::ISOLatinGreek;
+ case 28598:
+ return __te_impl::__id::ISOLatinHebrew;
+ case 28599:
+ return __te_impl::__id::Windows31Latin5;
+ case 28603:
+ return __te_impl::__id::ISO885913;
+ case 28605:
+ return __te_impl::__id::ISO885915;
+ case 38598:
+ return __te_impl::__id::ISO88598I;
+ case 50220:
+ case 50221:
+ case 50222:
+ return __te_impl::__id::ISO2022JP;
+ case 51932:
+ return __te_impl::__id::EUCPkdFmtJapanese;
+ case 51936:
+ return __te_impl::__id::GB2312;
+ case 51949:
+ return __te_impl::__id::EUCKR;
+ case 52936:
+ return __te_impl::__id::HZGB2312;
+ case 54936:
+ return __te_impl::__id::GB18030;
+ case 65000:
+ return __te_impl::__id::UTF7;
+ case 65001:
+ return __te_impl::__id::UTF8;
+ default:
+ return __te_impl::__id::other;
+ }
+}
+#endif // _LIBCPP_WIN32API
+
+#if !defined(__ANDROID__) && !defined(_LIBCPP_WIN32API)
+_LIBCPP_HIDDEN __te_impl __te_impl::__get_locale_encoding(const char* __name) {
+ __te_impl __e;
+
+ __locale::__locale_t __l = __locale::__newlocale(_LIBCPP_CTYPE_MASK, __name, static_cast<__locale::__locale_t>(0));
+
+ if (!__l) {
+ return __e;
+ }
+
+ const char* __codeset = __locale::__nl_langinfo_l(_LIBCPP_NL_CODESET, __l);
+
+ if (!__codeset) {
+ return __e;
+ }
+
+ string_view __codeset_sv(__codeset);
+
+ if (__codeset_sv.size() <= __te_impl::__max_name_length_) {
+ __e = __te_impl(__codeset_sv);
+ }
+
+ __locale::__freelocale(__l);
+
+ return __e;
+}
+
+#else
+_LIBCPP_HIDDEN __te_impl __te_impl::__get_locale_encoding(const char* __name [[maybe_unused]]) { return __te_impl(); }
+#endif
+
+_LIBCPP_HIDDEN __te_impl __te_impl::__get_env_encoding() {
+#if defined(_LIBCPP_WIN32API)
+ return __te_impl(__get_win32_acp());
+#else
+ return __get_locale_encoding("");
+#endif // _LIBCPP_WIN32API
+}
+
+_LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_EXPORTED_FROM_ABI __te_impl __te_impl::__environment() {
+ return __te_impl::__get_env_encoding();
+}
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index c0031543e47bc..7d8aad95f3b8c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -2282,6 +2282,39 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
+text_encoding algorithm
+text_encoding atomic
+text_encoding bit
+text_encoding cctype
+text_encoding climits
+text_encoding cmath
+text_encoding compare
+text_encoding concepts
+text_encoding cstddef
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstdlib
+text_encoding cstring
+text_encoding ctime
+text_encoding cwchar
+text_encoding cwctype
+text_encoding exception
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding iterator
+text_encoding limits
+text_encoding memory
+text_encoding new
+text_encoding optional
+text_encoding ratio
+text_encoding stdexcept
+text_encoding string_view
+text_encoding tuple
+text_encoding type_traits
+text_encoding typeinfo
+text_encoding utility
+text_encoding variant
+text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index c0031543e47bc..7d8aad95f3b8c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -2282,6 +2282,39 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
+text_encoding algorithm
+text_encoding atomic
+text_encoding bit
+text_encoding cctype
+text_encoding climits
+text_encoding cmath
+text_encoding compare
+text_encoding concepts
+text_encoding cstddef
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstdlib
+text_encoding cstring
+text_encoding ctime
+text_encoding cwchar
+text_encoding cwctype
+text_encoding exception
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding iterator
+text_encoding limits
+text_encoding memory
+text_encoding new
+text_encoding optional
+text_encoding ratio
+text_encoding stdexcept
+text_encoding string_view
+text_encoding tuple
+text_encoding type_traits
+text_encoding typeinfo
+text_encoding utility
+text_encoding variant
+text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index c2eb5b44e8d7a..bbdb10a75993d 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -2328,6 +2328,40 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
+text_encoding algorithm
+text_encoding atomic
+text_encoding bit
+text_encoding cctype
+text_encoding climits
+text_encoding cmath
+text_encoding compare
+text_encoding concepts
+text_encoding cstddef
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstdlib
+text_encoding cstring
+text_encoding ctime
+text_encoding cwchar
+text_encoding cwctype
+text_encoding exception
+text_encoding execution
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding iterator
+text_encoding limits
+text_encoding memory
+text_encoding new
+text_encoding optional
+text_encoding ratio
+text_encoding stdexcept
+text_encoding string_view
+text_encoding tuple
+text_encoding type_traits
+text_encoding typeinfo
+text_encoding utility
+text_encoding variant
+text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 332cb62f35b5f..53b8325423fa9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -2335,6 +2335,39 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
+text_encoding algorithm
+text_encoding atomic
+text_encoding bit
+text_encoding cctype
+text_encoding climits
+text_encoding cmath
+text_encoding compare
+text_encoding concepts
+text_encoding cstddef
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstdlib
+text_encoding cstring
+text_encoding ctime
+text_encoding cwchar
+text_encoding cwctype
+text_encoding exception
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding iterator
+text_encoding limits
+text_encoding memory
+text_encoding new
+text_encoding optional
+text_encoding ratio
+text_encoding stdexcept
+text_encoding string_view
+text_encoding tuple
+text_encoding type_traits
+text_encoding typeinfo
+text_encoding utility
+text_encoding variant
+text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 55c79acff5a8f..f15b13738dd8a 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -2365,6 +2365,39 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
+text_encoding algorithm
+text_encoding atomic
+text_encoding bit
+text_encoding cctype
+text_encoding climits
+text_encoding cmath
+text_encoding compare
+text_encoding concepts
+text_encoding cstddef
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstdlib
+text_encoding cstring
+text_encoding ctime
+text_encoding cwchar
+text_encoding cwctype
+text_encoding exception
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding iterator
+text_encoding limits
+text_encoding memory
+text_encoding new
+text_encoding optional
+text_encoding ratio
+text_encoding stdexcept
+text_encoding string_view
+text_encoding tuple
+text_encoding type_traits
+text_encoding typeinfo
+text_encoding utility
+text_encoding variant
+text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index c5cc61f06678c..4714f5f9ca0ba 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -1069,6 +1069,19 @@ system_error string
system_error string_view
system_error tuple
system_error version
+text_encoding cctype
+text_encoding compare
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstring
+text_encoding cwchar
+text_encoding cwctype
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding limits
+text_encoding stdexcept
+text_encoding string_view
+text_encoding version
thread array
thread atomic
thread bitset
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index c11fb5ac10016..f79e0f5ef60ec 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -1048,6 +1048,19 @@ system_error string
system_error string_view
system_error tuple
system_error version
+text_encoding cctype
+text_encoding compare
+text_encoding cstdint
+text_encoding cstdio
+text_encoding cstring
+text_encoding cwchar
+text_encoding cwctype
+text_encoding initializer_list
+text_encoding iosfwd
+text_encoding limits
+text_encoding stdexcept
+text_encoding string_view
+text_encoding version
thread array
thread atomic
thread bitset
diff --git a/libcxx/test/libcxx/utilities/text_encoding/environment.pass.cpp b/libcxx/test/libcxx/utilities/text_encoding/environment.pass.cpp
new file mode 100644
index 0000000000000..03909f474a246
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/text_encoding/environment.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <text_encoding>
+
+// REQUIRES: std-at-least-c++26
+// REQUIRES: locale.fr_CA.ISO8859-1
+
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: android
+// UNSUPPORTED: windows
+// UNSUPPORTED: availability-te-environment-missing
+
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <text_encoding>
+
+#include "platform_support.h" // locale name macros
+
+int main(int, char**) {
+ // text_encoding::environment() is (unfortunately) affected by changes to the "LANG" environment variable on POSIX systems.
+ {
+ setenv("LANG", LOCALE_fr_CA_ISO8859_1, 1);
+
+ auto te = std::text_encoding::environment();
+
+ assert(std::text_encoding::environment_is<std::text_encoding::id::ISOLatin1>());
+ assert(te == std::text_encoding::environment());
+ assert(te.mib() == std::text_encoding::id::ISOLatin1);
+ assert(std::ranges::contains(te.aliases(), std::string_view("ISO_8859-1")));
+ }
+}
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
new file mode 100644
index 0000000000000..e1c966902a343
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: libcpp-hardening-mode={{extensive|debug}}
+
+// <text_encoding>
+
+// text_encoding text_encoding(id)
+
+#include <climits>
+#include <text_encoding>
+
+#include "check_assertion.h"
+
+int main(int, char**) {
+ // Make sure that text_encoding(id) asserts when the input id not in range of allowed values
+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::text_encoding(std::text_encoding::id(33)), "invalid text_encoding::id passed to text_encoding(id)");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::text_encoding(std::text_encoding::id(34)), "invalid text_encoding::id passed to text_encoding(id)");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::text_encoding(std::text_encoding::id(-1)), "invalid text_encoding::id passed to text_encoding(id)");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::text_encoding(std::text_encoding::id(INT_MAX)), "invalid text_encoding::id passed to text_encoding(id)");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
new file mode 100644
index 0000000000000..75bee493bbf68
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: libcpp-hardening-mode={{extensive|debug}}
+
+// <text_encoding>
+
+// text_encoding text_encoding(string_view)
+
+#include <string_view>
+#include <text_encoding>
+
+#include "check_assertion.h"
+
+int main(int, char**) {
+ char str[std::text_encoding::max_name_length + 2] =
+ "HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELL";
+ std::string_view view(str);
+
+ // text_encoding(string_view) asserts if its input size() > max_name_length
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view), "invalid string passed to text_encoding(string_view)");
+
+ // text_encoding(string_view) asserts if its input contains a null terminator
+ char str2[std::text_encoding::max_name_length] = "HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELL";
+ std::string_view view2(str2);
+ str2[3] = '\0';
+
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view2), "invalid string passed to text_encoding(string_view)");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/environment.nodiscard.verify.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/environment.nodiscard.verify.cpp
new file mode 100644
index 0000000000000..97dc5c713f7a4
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/environment.nodiscard.verify.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: android
+// UNSUPPORTED: availability-te-environment-missing
+
+// <text_encoding>
+
+// text_encoding text_encoding::environment()
+
+// Split from the general [[nodiscard]] tests to accomodate no-localization builds.
+
+#include <text_encoding>
+
+int main(int, char**) {
+ // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::text_encoding::environment();
+ // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::text_encoding::environment_is<std::text_encoding::UTF8>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/nodiscard.verify.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/nodiscard.verify.cpp
new file mode 100644
index 0000000000000..8c9324c4f4b7c
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.members/nodiscard.verify.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// UNSUPPORTED: no-localization
+
+// <text_encoding>
+
+#include <text_encoding>
+
+int main(int, char**) {
+ std::text_encoding te = std::text_encoding();
+ // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+ te.mib();
+ // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+ te.name();
+ // expected-warning at +1 {{ignoring return value of function declared with 'nodiscard' attribute}}
+ te.aliases();
+
+ // Clang does not emit a nodiscard warning for consteval functions with [[nodiscard]]: See issue #141536
+ // expected-warning at +1 {{expression result unused}}
+ std::text_encoding::literal();
+
+ return 0;
+}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/text_encoding.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/text_encoding.version.compile.pass.cpp
new file mode 100644
index 0000000000000..1678e8840af8d
--- /dev/null
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/text_encoding.version.compile.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <text_encoding>
+
+// Test the feature test macros defined by <text_encoding>
+
+// clang-format off
+
+#include <text_encoding>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should not be defined before c++26"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should not be defined before c++26"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should not be defined before c++26"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# ifdef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should not be defined before c++26"
+# endif
+
+#elif TEST_STD_VER == 23
+
+# ifdef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should not be defined before c++26"
+# endif
+
+#elif TEST_STD_VER > 23
+
+# ifndef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should be defined in c++26"
+# endif
+# if __cpp_lib_text_encoding != 202306L
+# error "__cpp_lib_text_encoding should have the value 202306L in c++26"
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index f442b22c6d752..767479b30cef3 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -8035,17 +8035,11 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_text_encoding
-# error "__cpp_lib_text_encoding should be defined in c++26"
-# endif
-# if __cpp_lib_text_encoding != 202306L
-# error "__cpp_lib_text_encoding should have the value 202306L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_text_encoding
-# error "__cpp_lib_text_encoding should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_text_encoding
+# error "__cpp_lib_text_encoding should be defined in c++26"
+# endif
+# if __cpp_lib_text_encoding != 202306L
+# error "__cpp_lib_text_encoding should have the value 202306L in c++26"
# endif
# ifndef __cpp_lib_three_way_comparison
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
index 002fc4b1ec7ef..5b0b31f4b7e98 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
@@ -31,6 +31,11 @@
#include "platform_support.h" // locale name macros
#include "test_macros.h"
+// glibc <langinfo.h> has a THOUSANDS_SEP macro already defined
+#ifdef THOUSANDS_SEP
+# undef THOUSANDS_SEP
+#endif
+
#ifdef _AIX
// the AIX libc expects U202F as LC_MONETARY thousands_sep
# define THOUSANDS_SEP L"\u202F"
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
index 733eea94fd9bd..171a3ab9f75d4 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
@@ -32,6 +32,11 @@
#include "platform_support.h" // locale name macros
#include "test_macros.h"
+// glibc <langinfo.h> has a THOUSANDS_SEP macro already defined
+#ifdef THOUSANDS_SEP
+# undef THOUSANDS_SEP
+#endif
+
#ifdef _AIX
// the AIX libc expects U202F as LC_MONETARY thousands_sep
# define THOUSANDS_SEP L"\u202F"
diff --git a/libcxx/test/std/localization/locales/locale/locale.members/encoding.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.members/encoding.pass.cpp
new file mode 100644
index 0000000000000..e77ad12eb2267
--- /dev/null
+++ b/libcxx/test/std/localization/locales/locale/locale.members/encoding.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <text_encoding>
+
+// REQUIRES: std-at-least-c++26
+// REQUIRES: locale.en_US.UTF-8
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: android
+
+// class locale
+
+// text_encoding encoding() const
+
+#include <cassert>
+#include <locale>
+#include <text_encoding>
+
+#include "test_macros.h"
+#include "platform_support.h"
+
+using id = std::text_encoding::id;
+
+int main(int, char**) {
+// FIXME: enable once locale::encoding() is implemented
+#if false
+ {
+ // 1. Default locale returns a text_encoding representing "ASCII"
+ std::locale loc;
+
+ auto te = loc.encoding();
+ auto classicTE = std::text_encoding(id::ASCII);
+ assert(te == id::ASCII);
+ assert(te == classicTE);
+ }
+
+ {
+ // 2. Locale built with en_US.UTF-8 returns text_encoding representing "UTF-8"
+ std::locale utf8Locale(LOCALE_en_US_UTF_8);
+
+ auto te = utf8Locale.encoding();
+ auto utf8TE = std::text_encoding(id::UTF8);
+ assert(te == id::UTF8);
+ assert(te == utf8TE);
+ }
+#endif
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/test_text_encoding.h b/libcxx/test/std/utilities/text_encoding/test_text_encoding.h
new file mode 100644
index 0000000000000..1458f6ab7d907
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/test_text_encoding.h
@@ -0,0 +1,282 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUPPORT_TEST_TEXT_ENCODING_H
+#define SUPPORT_TEST_TEXT_ENCODING_H
+
+#include <string_view>
+
+struct encoding_data {
+ std::string_view name;
+ int mib;
+ int size;
+};
+
+constexpr encoding_data unique_encoding_data[]{
+ {"US-ASCII", 3, 8},
+ {"ISO_8859-1:1987", 4, 15},
+ {"ISO_8859-2:1987", 5, 15},
+ {"ISO_8859-3:1988", 6, 15},
+ {"ISO_8859-4:1988", 7, 15},
+ {"ISO_8859-5:1988", 8, 15},
+ {"ISO_8859-6:1987", 9, 15},
+ {"ISO_8859-7:1987", 10, 15},
+ {"ISO_8859-8:1988", 11, 15},
+ {"ISO_8859-9:1989", 12, 15},
+ {"ISO-8859-10", 13, 11},
+ {"ISO_6937-2-add", 14, 14},
+ {"JIS_X0201", 15, 9},
+ {"JIS_Encoding", 16, 12},
+ {"Shift_JIS", 17, 9},
+ {"Extended_UNIX_Code_Packed_Format_for_Japanese", 18, 45},
+ {"Extended_UNIX_Code_Fixed_Width_for_Japanese", 19, 43},
+ {"BS_4730", 20, 7},
+ {"SEN_850200_C", 21, 12},
+ {"IT", 22, 2},
+ {"ES", 23, 2},
+ {"DIN_66003", 24, 9},
+ {"NS_4551-1", 25, 9},
+ {"NF_Z_62-010", 26, 11},
+ {"ISO-10646-UTF-1", 27, 15},
+ {"ISO_646.basic:1983", 28, 18},
+ {"INVARIANT", 29, 9},
+ {"ISO_646.irv:1983", 30, 16},
+ {"NATS-SEFI", 31, 9},
+ {"NATS-SEFI-ADD", 32, 13},
+ {"SEN_850200_B", 35, 12},
+ {"KS_C_5601-1987", 36, 14},
+ {"ISO-2022-KR", 37, 11},
+ {"EUC-KR", 38, 6},
+ {"ISO-2022-JP", 39, 11},
+ {"ISO-2022-JP-2", 40, 13},
+ {"JIS_C6220-1969-jp", 41, 17},
+ {"JIS_C6220-1969-ro", 42, 17},
+ {"PT", 43, 2},
+ {"greek7-old", 44, 10},
+ {"latin-greek", 45, 11},
+ {"NF_Z_62-010_(1973)", 46, 18},
+ {"Latin-greek-1", 47, 13},
+ {"ISO_5427", 48, 8},
+ {"JIS_C6226-1978", 49, 14},
+ {"BS_viewdata", 50, 11},
+ {"INIS", 51, 4},
+ {"INIS-8", 52, 6},
+ {"INIS-cyrillic", 53, 13},
+ {"ISO_5427:1981", 54, 13},
+ {"ISO_5428:1980", 55, 13},
+ {"GB_1988-80", 56, 10},
+ {"GB_2312-80", 57, 10},
+ {"NS_4551-2", 58, 9},
+ {"videotex-suppl", 59, 14},
+ {"PT2", 60, 3},
+ {"ES2", 61, 3},
+ {"MSZ_7795.3", 62, 10},
+ {"JIS_C6226-1983", 63, 14},
+ {"greek7", 64, 6},
+ {"ASMO_449", 65, 8},
+ {"iso-ir-90", 66, 9},
+ {"JIS_C6229-1984-a", 67, 16},
+ {"JIS_C6229-1984-b", 68, 16},
+ {"JIS_C6229-1984-b-add", 69, 20},
+ {"JIS_C6229-1984-hand", 70, 19},
+ {"JIS_C6229-1984-hand-add", 71, 23},
+ {"JIS_C6229-1984-kana", 72, 19},
+ {"ISO_2033-1983", 73, 13},
+ {"ANSI_X3.110-1983", 74, 16},
+ {"T.61-7bit", 75, 9},
+ {"T.61-8bit", 76, 9},
+ {"ECMA-cyrillic", 77, 13},
+ {"CSA_Z243.4-1985-1", 78, 17},
+ {"CSA_Z243.4-1985-2", 79, 17},
+ {"CSA_Z243.4-1985-gr", 80, 18},
+ {"ISO_8859-6-E", 81, 12},
+ {"ISO_8859-6-I", 82, 12},
+ {"T.101-G2", 83, 8},
+ {"ISO_8859-8-E", 84, 12},
+ {"ISO_8859-8-I", 85, 12},
+ {"CSN_369103", 86, 10},
+ {"JUS_I.B1.002", 87, 12},
+ {"IEC_P27-1", 88, 9},
+ {"JUS_I.B1.003-serb", 89, 17},
+ {"JUS_I.B1.003-mac", 90, 16},
+ {"greek-ccitt", 91, 11},
+ {"NC_NC00-10:81", 92, 13},
+ {"ISO_6937-2-25", 93, 13},
+ {"GOST_19768-74", 94, 13},
+ {"ISO_8859-supp", 95, 13},
+ {"ISO_10367-box", 96, 13},
+ {"latin-lap", 97, 9},
+ {"JIS_X0212-1990", 98, 14},
+ {"DS_2089", 99, 7},
+ {"us-dk", 100, 5},
+ {"dk-us", 101, 5},
+ {"KSC5636", 102, 7},
+ {"UNICODE-1-1-UTF-7", 103, 17},
+ {"ISO-2022-CN", 104, 11},
+ {"ISO-2022-CN-EXT", 105, 15},
+ {"UTF-8", 106, 5},
+ {"ISO-8859-13", 109, 11},
+ {"ISO-8859-14", 110, 11},
+ {"ISO-8859-15", 111, 11},
+ {"ISO-8859-16", 112, 11},
+ {"GBK", 113, 3},
+ {"GB18030", 114, 7},
+ {"OSD_EBCDIC_DF04_15", 115, 18},
+ {"OSD_EBCDIC_DF03_IRV", 116, 19},
+ {"OSD_EBCDIC_DF04_1", 117, 17},
+ {"ISO-11548-1", 118, 11},
+ {"KZ-1048", 119, 7},
+ {"ISO-10646-UCS-2", 1000, 15},
+ {"ISO-10646-UCS-4", 1001, 15},
+ {"ISO-10646-UCS-Basic", 1002, 19},
+ {"ISO-10646-Unicode-Latin1", 1003, 24},
+ {"ISO-10646-J-1", 1004, 13},
+ {"ISO-Unicode-IBM-1261", 1005, 20},
+ {"ISO-Unicode-IBM-1268", 1006, 20},
+ {"ISO-Unicode-IBM-1276", 1007, 20},
+ {"ISO-Unicode-IBM-1264", 1008, 20},
+ {"ISO-Unicode-IBM-1265", 1009, 20},
+ {"UNICODE-1-1", 1010, 11},
+ {"SCSU", 1011, 4},
+ {"UTF-7", 1012, 5},
+ {"UTF-16BE", 1013, 8},
+ {"UTF-16LE", 1014, 8},
+ {"UTF-16", 1015, 6},
+ {"CESU-8", 1016, 6},
+ {"UTF-32", 1017, 6},
+ {"UTF-32BE", 1018, 8},
+ {"UTF-32LE", 1019, 8},
+ {"BOCU-1", 1020, 6},
+ {"UTF-7-IMAP", 1021, 10},
+ {"ISO-8859-1-Windows-3.0-Latin-1", 2000, 30},
+ {"ISO-8859-1-Windows-3.1-Latin-1", 2001, 30},
+ {"ISO-8859-2-Windows-Latin-2", 2002, 26},
+ {"ISO-8859-9-Windows-Latin-5", 2003, 26},
+ {"hp-roman8", 2004, 9},
+ {"Adobe-Standard-Encoding", 2005, 23},
+ {"Ventura-US", 2006, 10},
+ {"Ventura-International", 2007, 21},
+ {"DEC-MCS", 2008, 7},
+ {"IBM850", 2009, 6},
+ {"IBM852", 2010, 6},
+ {"IBM437", 2011, 6},
+ {"PC8-Danish-Norwegian", 2012, 20},
+ {"IBM862", 2013, 6},
+ {"PC8-Turkish", 2014, 11},
+ {"IBM-Symbols", 2015, 11},
+ {"IBM-Thai", 2016, 8},
+ {"HP-Legal", 2017, 8},
+ {"HP-Pi-font", 2018, 10},
+ {"HP-Math8", 2019, 8},
+ {"Adobe-Symbol-Encoding", 2020, 21},
+ {"HP-DeskTop", 2021, 10},
+ {"Ventura-Math", 2022, 12},
+ {"Microsoft-Publishing", 2023, 20},
+ {"Windows-31J", 2024, 11},
+ {"GB2312", 2025, 6},
+ {"Big5", 2026, 4},
+ {"macintosh", 2027, 9},
+ {"IBM037", 2028, 6},
+ {"IBM038", 2029, 6},
+ {"IBM273", 2030, 6},
+ {"IBM274", 2031, 6},
+ {"IBM275", 2032, 6},
+ {"IBM277", 2033, 6},
+ {"IBM278", 2034, 6},
+ {"IBM280", 2035, 6},
+ {"IBM281", 2036, 6},
+ {"IBM284", 2037, 6},
+ {"IBM285", 2038, 6},
+ {"IBM290", 2039, 6},
+ {"IBM297", 2040, 6},
+ {"IBM420", 2041, 6},
+ {"IBM423", 2042, 6},
+ {"IBM424", 2043, 6},
+ {"IBM500", 2044, 6},
+ {"IBM851", 2045, 6},
+ {"IBM855", 2046, 6},
+ {"IBM857", 2047, 6},
+ {"IBM860", 2048, 6},
+ {"IBM861", 2049, 6},
+ {"IBM863", 2050, 6},
+ {"IBM864", 2051, 6},
+ {"IBM865", 2052, 6},
+ {"IBM868", 2053, 6},
+ {"IBM869", 2054, 6},
+ {"IBM870", 2055, 6},
+ {"IBM871", 2056, 6},
+ {"IBM880", 2057, 6},
+ {"IBM891", 2058, 6},
+ {"IBM903", 2059, 6},
+ {"IBM904", 2060, 6},
+ {"IBM905", 2061, 6},
+ {"IBM918", 2062, 6},
+ {"IBM1026", 2063, 7},
+ {"EBCDIC-AT-DE", 2064, 12},
+ {"EBCDIC-AT-DE-A", 2065, 14},
+ {"EBCDIC-CA-FR", 2066, 12},
+ {"EBCDIC-DK-NO", 2067, 12},
+ {"EBCDIC-DK-NO-A", 2068, 14},
+ {"EBCDIC-FI-SE", 2069, 12},
+ {"EBCDIC-FI-SE-A", 2070, 14},
+ {"EBCDIC-FR", 2071, 9},
+ {"EBCDIC-IT", 2072, 9},
+ {"EBCDIC-PT", 2073, 9},
+ {"EBCDIC-ES", 2074, 9},
+ {"EBCDIC-ES-A", 2075, 11},
+ {"EBCDIC-ES-S", 2076, 11},
+ {"EBCDIC-UK", 2077, 9},
+ {"EBCDIC-US", 2078, 9},
+ {"UNKNOWN-8BIT", 2079, 12},
+ {"MNEMONIC", 2080, 8},
+ {"MNEM", 2081, 4},
+ {"VISCII", 2082, 6},
+ {"VIQR", 2083, 4},
+ {"KOI8-R", 2084, 6},
+ {"HZ-GB-2312", 2085, 10},
+ {"IBM866", 2086, 6},
+ {"IBM775", 2087, 6},
+ {"KOI8-U", 2088, 6},
+ {"IBM00858", 2089, 8},
+ {"IBM00924", 2090, 8},
+ {"IBM01140", 2091, 8},
+ {"IBM01141", 2092, 8},
+ {"IBM01142", 2093, 8},
+ {"IBM01143", 2094, 8},
+ {"IBM01144", 2095, 8},
+ {"IBM01145", 2096, 8},
+ {"IBM01146", 2097, 8},
+ {"IBM01147", 2098, 8},
+ {"IBM01148", 2099, 8},
+ {"IBM01149", 2100, 8},
+ {"Big5-HKSCS", 2101, 10},
+ {"IBM1047", 2102, 7},
+ {"PTCP154", 2103, 7},
+ {"Amiga-1251", 2104, 10},
+ {"KOI7-switched", 2105, 13},
+ {"BRF", 2106, 3},
+ {"TSCII", 2107, 5},
+ {"CP51932", 2108, 7},
+ {"windows-874", 2109, 11},
+ {"windows-1250", 2250, 12},
+ {"windows-1251", 2251, 12},
+ {"windows-1252", 2252, 12},
+ {"windows-1253", 2253, 12},
+ {"windows-1254", 2254, 12},
+ {"windows-1255", 2255, 12},
+ {"windows-1256", 2256, 12},
+ {"windows-1257", 2257, 12},
+ {"windows-1258", 2258, 12},
+ {"TIS-620", 2259, 7},
+ {"CP50220", 2260, 7},
+};
+
+constexpr std::string_view other_names[]{
+ "graah", "oops", "libcxx", "foobar", "barbaz", "1234567", "llvm-project", "utf-81", "utf-9", "CA-ASCII"};
+
+#endif // SUPPORT_TEST_TEXT_ENCODING_H
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
new file mode 100644
index 0000000000000..d84b36d86d88f
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::text_encoding() noexcept
+
+#include <cassert>
+#include <text_encoding>
+#include <type_traits>
+
+constexpr bool test() {
+ std::text_encoding te = std::text_encoding();
+ assert(te.mib() == std::text_encoding::unknown);
+ assert(std::string_view("") == te.name());
+
+ return true;
+}
+
+int main(int, char**) {
+ // 1. Default constructor must be nothrow
+ {
+ static_assert(
+ std::is_nothrow_default_constructible<std::text_encoding>::value, "Must be nothrow default constructible");
+ }
+
+ // 2. Default constructing a text_encoding object makes it so that mib() == id::unknown, and its name is empty
+ {
+ test();
+ static_assert(test());
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
new file mode 100644
index 0000000000000..aadae652d5b91
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::text_encoding(id) noexcept
+
+#include <algorithm>
+#include <cassert>
+#include <ranges>
+#include <text_encoding>
+#include <type_traits>
+
+#include "../test_text_encoding.h"
+
+using id = std::text_encoding::id;
+
+constexpr void id_ctor(id i, id expect_id, std::string_view expect_name) {
+ std::text_encoding te = std::text_encoding(i);
+
+ assert(te.mib() == expect_id);
+ assert(expect_name == te.name());
+ assert(std::ranges::contains(te.aliases(), expect_name));
+}
+
+constexpr void id_ctors() {
+ for (auto pair : unique_encoding_data) {
+ id_ctor(id(pair.mib), id(pair.mib), pair.name);
+ }
+}
+
+constexpr void test_unknown_other() {
+ {
+ std::text_encoding te = std::text_encoding(id::other);
+
+ assert(te.mib() == id::other);
+ assert(std::string_view("") == te.name());
+ assert(std::ranges::empty(te.aliases()));
+ }
+
+ {
+ std::text_encoding te = std::text_encoding(id::unknown);
+
+ assert(te.mib() == id::unknown);
+ assert(std::string_view("") == te.name());
+ assert(std::ranges::empty(te.aliases()));
+ }
+}
+
+constexpr bool test() {
+ {
+ // 2. Constructing an object with a valid id must set mib() and the name to the corresponding value.
+ id_ctors();
+ }
+
+ {
+ // 3. Constructing an object using id::unknown or id::other must set mib() to id::unknown or id::other, respectively, and the name to an empty string.
+ test_unknown_other();
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ {
+ // 1. text_encoding(id) must be nothrow
+ static_assert(std::is_nothrow_constructible<std::text_encoding, std::text_encoding::id>::value,
+ "Must be nothrow constructible with id");
+ }
+
+ {
+ test();
+ static_assert(test());
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
new file mode 100644
index 0000000000000..8b92d5fa7fba8
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=30000000
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=99000000
+
+// <text_encoding>
+
+// text_encoding::text_encoding(string_view) noexcept
+
+#include <cassert>
+#include <string_view>
+#include <text_encoding>
+#include <type_traits>
+
+#include "../test_text_encoding.h"
+
+constexpr void test_ctor(std::string_view str, std::string_view expect, std::text_encoding::id expect_id) {
+ std::text_encoding te = std::text_encoding(str);
+
+ assert(te.mib() == expect_id);
+ assert(te.name() == expect);
+}
+
+constexpr void test_primary_encoding_spellings() {
+ for (auto& data : unique_encoding_data) {
+ std::text_encoding te = std::text_encoding(data.name);
+
+ assert(te.mib() == std::text_encoding::id(data.mib));
+ assert(te.name() == data.name);
+ }
+}
+
+constexpr void test_others() {
+ for (auto& name : other_names) {
+ std::text_encoding te = std::text_encoding(name);
+
+ assert(te.mib() == std::text_encoding::other);
+ assert(te.name() == name);
+ }
+}
+
+constexpr bool test() {
+ // happy paths
+ {
+ test_primary_encoding_spellings();
+ }
+
+ {
+ test_ctor("U_T_F-8", "U_T_F-8", std::text_encoding::UTF8);
+ }
+
+ {
+ test_ctor("utf8", "utf8", std::text_encoding::UTF8);
+ }
+
+ {
+ test_ctor("u.t.f-008", "u.t.f-008", std::text_encoding::UTF8);
+ }
+
+ {
+ test_ctor("utf-80", "utf-80", std::text_encoding::other);
+ }
+
+ {
+ test_ctor("iso885931988", "iso885931988", std::text_encoding::ISOLatin3);
+ }
+
+ {
+ test_ctor("iso00885931988", "iso00885931988", std::text_encoding::ISOLatin3);
+ }
+
+ {
+ test_others();
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ {
+ static_assert(std::is_nothrow_constructible<std::text_encoding, std::string_view>::value,
+ "Must be nothrow constructible with string_view");
+ }
+
+ {
+ test();
+ static_assert(test());
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
new file mode 100644
index 0000000000000..3dd8b4322e82e
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// bool text_encoding::operator==(const text_encoding&, id) noexcept
+
+#include <cassert>
+#include <text_encoding>
+
+#include "test_macros.h"
+#include "../test_text_encoding.h"
+
+using id = std::text_encoding::id;
+
+constexpr void test_primary_encodings() {
+ for (auto& data : unique_encoding_data) {
+ std::text_encoding te = std::text_encoding(id(data.mib));
+ assert(te == id(data.mib));
+ }
+}
+
+constexpr bool test() {
+ // 1. operator==(const text_encoding&, id) must be noexcept
+ {
+ std::text_encoding te = std::text_encoding();
+ ASSERT_NOEXCEPT(te == id::UTF8);
+ }
+
+ // 2. operator==(const text_encoding&, id) returns true if mib() is equal to the id
+ {
+ assert(std::text_encoding(id::UTF8) == id::UTF8);
+ }
+
+ // 2.1
+ {
+ assert(std::text_encoding() == id::unknown);
+ }
+
+ // 2.1.1
+ {
+ assert(std::text_encoding(id::unknown) == id::unknown);
+ }
+
+ // 2.2
+ {
+ assert(std::text_encoding(id::other) == id::other);
+ }
+
+ // 3. operator==(const text_encoding&, id) returns false if mib() is not equal to the id
+ {
+ assert(!(std::text_encoding(id::UTF8) == id::UTF16));
+ }
+
+ {
+ test_primary_encodings();
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
new file mode 100644
index 0000000000000..eefbf02bc5bcf
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// bool text_encoding::operator==(const text_encoding&, const text_encoding&) noexcept
+
+#include <cassert>
+#include <text_encoding>
+
+#include "test_macros.h"
+
+using id = std::text_encoding::id;
+
+constexpr bool test() {
+ // 1. operator==(const text_encoding&, const text_encoding&) must be noexcept
+ {
+ ASSERT_NOEXCEPT(std::text_encoding() == std::text_encoding());
+ }
+
+ // 2. operator==(const text_encoding&, const text_encoding&) returns true if both text_encoding ids are equal
+ {
+ std::text_encoding te1 = std::text_encoding(id::UTF8);
+ std::text_encoding te2 = std::text_encoding(id::UTF8);
+ assert(te1 == te2);
+ }
+
+ // 3. operator==(const text_encoding&, const text_encoding&) for text_encodings with ids of "other" return true if the names are equal
+ {
+ std::text_encoding other_te1 = std::text_encoding("foo");
+ std::text_encoding other_te2 = std::text_encoding("foo");
+ assert(other_te1 == other_te2);
+ }
+
+ // 4. operator==(const text_encoding&, const text_encoding&) returns false when comparingtext_encodings with different ids
+ {
+ std::text_encoding te1 = std::text_encoding(id::UTF8);
+ std::text_encoding te2 = std::text_encoding(id::UTF16);
+ assert(!(te1 == te2));
+ }
+
+ // 5. operator==(const text_encoding&, const text_encoding&) for text_encodings with ids of "other" returns false if the names are not equal
+ {
+ std::text_encoding other_te1 = std::text_encoding("foo");
+ std::text_encoding other_te2 = std::text_encoding("bar");
+ assert(!(other_te1 == other_te2));
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.hash/enabled_hash.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.hash/enabled_hash.pass.cpp
new file mode 100644
index 0000000000000..981cb4f061268
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.hash/enabled_hash.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// template <> struct hash<text_encoding>
+
+#include <text_encoding>
+
+#include "poisoned_hash_helper.h"
+#include "test_macros.h"
+
+int main(int, char**) {
+ test_library_hash_specializations_available();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.hash/hash.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.hash/hash.pass.cpp
new file mode 100644
index 0000000000000..1171e2dab882b
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.hash/hash.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// template <> struct hash<text_encoding>
+
+#include <cassert>
+#include <cstdint>
+#include <text_encoding>
+#include <type_traits>
+
+void test_te_hash() {
+ using T = std::text_encoding;
+ using H = std::hash<T>;
+
+ {
+ const T te(T::ASCII);
+ const H h{};
+ assert(h(te) == h(te));
+ static_assert(std::is_same_v<decltype(h(te)), std::size_t>);
+ }
+
+ {
+ const T te1(T::ASCII);
+ const T te2(T::UTF8);
+ const H h{};
+
+ assert(h(te1) != h(te2));
+ }
+
+ {
+ const T te1(T::unknown);
+ const T te2(T::unknown);
+ const H h{};
+ assert(h(te1) == h(te2));
+ }
+
+ {
+ const T te1(T::other);
+ const T te2(T::other);
+ const H h{};
+ assert(h(te1) == h(te2));
+ }
+}
+
+int main(int, char**) {
+ test_te_hash();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
new file mode 100644
index 0000000000000..711ad99476e77
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::aliases_view;
+
+#include <concepts>
+#include <text_encoding>
+
+static_assert(std::copyable<std::text_encoding::aliases_view>);
+static_assert(std::ranges::view<std::text_encoding::aliases_view>);
+static_assert(std::ranges::random_access_range<std::text_encoding::aliases_view>);
+static_assert(std::ranges::borrowed_range<std::text_encoding::aliases_view>);
+static_assert(std::same_as<std::ranges::range_value_t<std::text_encoding::aliases_view>, const char*>);
+static_assert(std::same_as<std::ranges::range_reference_t<std::text_encoding::aliases_view>, const char*>);
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp
new file mode 100644
index 0000000000000..a527581ec1e34
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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: android
+// 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**) {
+ 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(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
+ assert(te.mib() == std::text_encoding::ASCII);
+ assert(std::text_encoding::environment_is<std::text_encoding::ASCII>());
+#elif defined(_WIN32)
+ assert(te.mib() == std::text_encoding::windows1252);
+ assert(std::text_encoding::environment_is<std::text_encoding::windows1252>());
+#endif
+ }
+
+ // 2. text_encoding::environment() still returns the default locale encoding when the locale is set to "en_US.UTF-8".
+ {
+ std::setlocale(LC_ALL, LOCALE_en_US_UTF_8);
+
+ std::text_encoding te2 = std::text_encoding::environment();
+ assert(te2 != std::text_encoding::UTF8);
+ assert(te == te2);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/literal.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/literal.pass.cpp
new file mode 100644
index 0000000000000..84390e7d9c5fe
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/literal.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding text_encoding::literal() noexcept;
+
+#include <cassert>
+#include <text_encoding>
+
+constexpr bool test() {
+ std::text_encoding te = std::text_encoding::literal();
+#ifdef __GNUC_EXECUTION_CHARSET_NAME
+ assert(std::string_view(te.name()) == std::string_view(__GNUC_EXECUTION_CHARSET_NAME));
+#elif defined(__clang_literal_encoding__)
+ assert(std::string_view(te.name()) == std::string_view(__clang_literal_encoding__));
+#else
+ assert(te.mib() = std::text_encoding::id::unknown);
+#endif
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
new file mode 100644
index 0000000000000..8664eeb6213ab
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::aliases_view::begin()
+
+#include <cassert>
+#include <ranges>
+#include <text_encoding>
+
+constexpr bool test() {
+ // 1. begin() of an aliases_view from a single text_encoding object are the same.
+ {
+ std::text_encoding te = std::text_encoding(std::text_encoding::UTF8);
+
+ std::text_encoding::aliases_view view1 = te.aliases();
+ std::text_encoding::aliases_view view2 = te.aliases();
+
+ assert(std::ranges::begin(view1) == std::ranges::begin(view2));
+ assert(view1.begin() == view2.begin());
+ }
+
+ // 2. begin() of aliases_views of two text_encoding objects that represent the same ID but hold different names are the same.
+ {
+ std::text_encoding te1 = std::text_encoding("ANSI_X3.4-1968");
+ std::text_encoding te2 = std::text_encoding("ANSI_X3.4-1986");
+
+ std::text_encoding::aliases_view view1 = te1.aliases();
+ std::text_encoding::aliases_view view2 = te2.aliases();
+
+ assert(view1.begin() == view2.begin());
+ assert(std::ranges::begin(view1) == std::ranges::begin(view2));
+ }
+
+ // 3. begin() of aliases_views of two text_encoding objects that represent different IDs are different.
+ {
+ std::text_encoding te1 = std::text_encoding(std::text_encoding::UTF8);
+ std::text_encoding te2 = std::text_encoding(std::text_encoding::ASCII);
+
+ std::text_encoding::aliases_view view1 = te1.aliases();
+ std::text_encoding::aliases_view view2 = te2.aliases();
+
+ assert(!(view1.begin() == view2.begin()));
+ assert(!(std::ranges::begin(view1) == std::ranges::begin(view2)));
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/empty.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/empty.pass.cpp
new file mode 100644
index 0000000000000..525d448054436
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/empty.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
+
+// <text_encoding>
+
+// text_encoding::aliases_view
+
+#include <cassert>
+#include <ranges>
+#include <text_encoding>
+
+#include "../../test_text_encoding.h"
+
+using id = std::text_encoding::id;
+
+constexpr void test_other_unknown() {
+ {
+ std::text_encoding te_other = std::text_encoding(id::other);
+
+ std::text_encoding::aliases_view other_range = te_other.aliases();
+
+ assert(std::ranges::empty(other_range));
+ assert(other_range.empty());
+ assert(!bool(other_range));
+ }
+
+ {
+ std::text_encoding te_unknown = std::text_encoding(id::unknown);
+
+ std::text_encoding::aliases_view unknown_range = te_unknown.aliases();
+ assert(std::ranges::empty(unknown_range));
+ assert(unknown_range.empty());
+ assert(!bool(unknown_range));
+ }
+}
+
+constexpr void test_primary_encodings() {
+ for (auto& data : unique_encoding_data) {
+ std::text_encoding te = std::text_encoding(id(data.mib));
+
+ std::text_encoding::aliases_view range = te.aliases();
+
+ assert(!std::ranges::empty(range));
+ assert(!range.empty());
+ assert(bool(range));
+ }
+}
+
+constexpr bool test() {
+ // 1. An alias_view of a text_encoding object for "other" and "unknown" are empty
+ {
+ test_other_unknown();
+ }
+
+ // 2. An alias_view of a text_encoding object for a known encoding e.g. "UTF-8" is not empty
+ {
+ test_primary_encodings();
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
new file mode 100644
index 0000000000000..b19069dd54b77
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::aliases_view::end()
+
+#include <cassert>
+#include <text_encoding>
+
+constexpr bool test() {
+ std::text_encoding a_other = std::text_encoding("foobar");
+
+ std::text_encoding::aliases_view other_aliases = a_other.aliases();
+
+ // 1. begin() of an aliases_view of "other" is equal to end()
+ assert(other_aliases.begin() == other_aliases.end());
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/front.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/front.pass.cpp
new file mode 100644
index 0000000000000..27970fdfd5976
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/front.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::aliases_view::front()
+
+#include <cassert>
+#include <ranges>
+#include <string_view>
+#include <text_encoding>
+
+using id = std::text_encoding::id;
+
+constexpr bool test() {
+ // 1. An aliases_view from a single text_encoding object returns the same front()
+ {
+ std::text_encoding te = std::text_encoding(id::UTF8);
+
+ std::text_encoding::aliases_view view1 = te.aliases();
+ std::text_encoding::aliases_view view2 = te.aliases();
+
+ assert(std::string_view(view1.front()) == std::string_view(view2.front()));
+ }
+
+ // 2. An aliases_views of two text_encoding objects that represent the same ID but hold different names return the same front()
+ {
+ std::text_encoding te1 = std::text_encoding("US-ASCII");
+ std::text_encoding te2 = std::text_encoding("ANSI_X3.4-1986");
+
+ std::text_encoding::aliases_view view1 = te1.aliases();
+ std::text_encoding::aliases_view view2 = te2.aliases();
+
+ assert(std::string_view(view1.front()) == std::string_view(view2.front()));
+ }
+
+ // 3. An aliases_views of two text_encoding objects that represent different IDs return different front()
+ {
+ std::text_encoding te1 = std::text_encoding(id::UTF8);
+ std::text_encoding te2 = std::text_encoding(id::ASCII);
+
+ std::text_encoding::aliases_view view1 = te1.aliases();
+ std::text_encoding::aliases_view view2 = te2.aliases();
+
+ assert(!(std::string_view(view1.front()) == std::string_view(view2.front())));
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
new file mode 100644
index 0000000000000..63e714c68abd3
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// text_encoding::aliases_view::iterator (implementation-defined)
+
+#include <cassert>
+#include <compare>
+#include <string_view>
+#include <text_encoding>
+#include <utility>
+
+constexpr bool test() {
+ // Test iterator operators.
+ std::text_encoding te = std::text_encoding(std::text_encoding::ASCII); // 11 aliases
+
+ auto i = te.aliases().begin();
+ auto j = te.aliases().begin();
+ auto k = te.aliases().end();
+
+ static_assert(std::three_way_comparable<decltype(i), std::strong_ordering>);
+
+ {
+ assert(i == j);
+ assert(i != k);
+ assert((i <=> j) == std::strong_ordering::equal);
+ assert(std::string_view(*i) == std::string_view(*j));
+ }
+ {
+ assert(std::string_view(i[0]) == std::string_view(j[0]));
+ assert(std::string_view(i[1]) != std::string_view(j[3]));
+ }
+ {
+ i++;
+ assert(i > j);
+ assert((i <=> j) == std::strong_ordering::greater);
+ assert(std::string_view(*i) != std::string_view(*j));
+ }
+ {
+ i--;
+ assert(i == te.aliases().begin());
+ assert(i == j);
+ assert(i != k);
+ assert(std::string_view(*i) == std::string_view(*j));
+ }
+ {
+ i++;
+ j++;
+ assert(i != te.aliases().begin());
+ assert(i == j);
+ assert(i != k);
+ assert(std::string_view(*i) == std::string_view(*j));
+ }
+ {
+ auto temp = i + 2;
+ assert(i != temp);
+ assert(std::string_view(*temp) != std::string_view(*j));
+ auto temp2 = temp - 2;
+ assert(std::string_view(*temp2) == std::string_view(*j));
+ }
+ {
+ assert(i - j == 0);
+ assert(k - i > 0);
+ }
+ {
+ auto temp = ++i;
+ assert(temp == i);
+ auto temp2 = j++;
+ assert(temp2 == j - 1);
+ assert(i == j);
+ }
+ {
+ i += 2;
+ j += 3;
+
+ auto tempi = i;
+ auto tempj = j;
+ assert(i != j);
+ assert((i <=> j) == std::strong_ordering::less);
+ i -= 2;
+ j -= 3;
+ assert(i == j);
+ assert(i != tempi && (tempi - i) == 2);
+ assert(j != tempj && (tempj - j) == 3);
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+ static_assert(test());
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/text_encoding/trivially_copyable.compile.pass.cpp b/libcxx/test/std/utilities/text_encoding/trivially_copyable.compile.pass.cpp
new file mode 100644
index 0000000000000..c16e60523c4d4
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/trivially_copyable.compile.pass.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+#include <text_encoding>
+#include <type_traits>
+
+static_assert(std::is_trivially_copyable_v<std::text_encoding>);
diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h
index b66fdff9b0491..f78aa39efd0d2 100644
--- a/libcxx/test/support/platform_support.h
+++ b/libcxx/test/support/platform_support.h
@@ -33,6 +33,7 @@
#define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8"
#define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 88431c76a00f5..581578db7d69f 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -1395,7 +1395,6 @@ def add_version_header(tc):
"c++26": 202306 # P1885R12 Naming Text Encodings to Demystify Them
},
"headers": ["text_encoding"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_three_way_comparison",
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index d06271a7908cc..ad011374a14a4 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -172,7 +172,6 @@ def __hash__(self) -> int:
"spanstream",
"stacktrace",
"stdfloat",
- "text_encoding",
]))
header_restrictions = {
diff --git a/libcxx/utils/libcxx/test/features/availability.py b/libcxx/utils/libcxx/test/features/availability.py
index 39c6cf45a1708..cf491e27dcef7 100644
--- a/libcxx/utils/libcxx/test/features/availability.py
+++ b/libcxx/utils/libcxx/test/features/availability.py
@@ -196,4 +196,12 @@
cfg.available_features,
),
),
+ # Tests that require std::text_encoding::environment() in the built library
+ Feature(
+ name="availability-te-environment-missing",
+ when=lambda cfg: BooleanExpression.evaluate(
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && !_target-has-llvm-22)",
+ cfg.available_features,
+ ),
+ ),
]
>From 560706a7dc5d4f556a9ff162483fdc9012f2a716 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Sat, 7 Feb 2026 16:25:23 -0500
Subject: [PATCH 02/17] Retarget to LLVM 23
---
libcxx/docs/Status/Cxx2cIssues.csv | 2 +-
libcxx/docs/Status/Cxx2cPapers.csv | 4 ++--
libcxx/include/__configuration/availability.h | 9 +++++++--
libcxx/utils/libcxx/test/features/availability.py | 2 +-
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libcxx/docs/Status/Cxx2cIssues.csv b/libcxx/docs/Status/Cxx2cIssues.csv
index f066eca24f3d3..847760b8b8f08 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -56,7 +56,7 @@
"`LWG4035 <https://wg21.link/LWG4035>`__","``single_view`` should provide ``empty``","2024-03 (Tokyo)","|Complete|","19","`#105328 <https://github.com/llvm/llvm-project/issues/105328>`__",""
"`LWG4036 <https://wg21.link/LWG4036>`__","``__alignof_is_defined`` is only implicitly specified in C++ and not yet deprecated","2024-03 (Tokyo)","","","`#105329 <https://github.com/llvm/llvm-project/issues/105329>`__",""
"`LWG4037 <https://wg21.link/LWG4037>`__","Static data members of ``ctype_base`` are not yet required to be usable in constant expressions","2024-03 (Tokyo)","","","`#105330 <https://github.com/llvm/llvm-project/issues/105330>`__",""
-"`LWG4038 <https://wg21.link/LWG4038>`__","``std::text_encoding::aliases_view`` should have constexpr iterators","2024-03 (Tokyo)","|Complete|","","`#105332 <https://github.com/llvm/llvm-project/issues/105332>`__",""
+"`LWG4038 <https://wg21.link/LWG4038>`__","``std::text_encoding::aliases_view`` should have constexpr iterators","2024-03 (Tokyo)","|Complete|","23","`#105332 <https://github.com/llvm/llvm-project/issues/105332>`__",""
"`LWG4043 <https://wg21.link/LWG4043>`__","""ASCII"" is not a registered character encoding","2024-03 (Tokyo)","|Nothing To Do|","","`#105335 <https://github.com/llvm/llvm-project/issues/105335>`__",""
"`LWG4045 <https://wg21.link/LWG4045>`__","``tuple`` can create dangling references from ``tuple-like``","2024-03 (Tokyo)","","","`#105337 <https://github.com/llvm/llvm-project/issues/105337>`__",""
"`LWG4053 <https://wg21.link/LWG4053>`__","Unary call to ``std::views::repeat`` does not decay the argument","2024-03 (Tokyo)","|Complete|","19","`#105338 <https://github.com/llvm/llvm-project/issues/105338>`__",""
diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv
index 77e488654099a..5cccf8c6d6163 100644
--- a/libcxx/docs/Status/Cxx2cPapers.csv
+++ b/libcxx/docs/Status/Cxx2cPapers.csv
@@ -13,7 +13,7 @@
"`P2013R5 <https://wg21.link/P2013R5>`__","Freestanding Language: Optional ``::operator new``","2023-06 (Varna)","","","`#105370 <https://github.com/llvm/llvm-project/issues/105370>`__",""
"`P2363R5 <https://wg21.link/P2363R5>`__","Extending associative containers with the remaining heterogeneous overloads","2023-06 (Varna)","","","`#105371 <https://github.com/llvm/llvm-project/issues/105371>`__",""
"`P1901R2 <https://wg21.link/P1901R2>`__","Enabling the Use of ``weak_ptr`` as Keys in Unordered Associative Containers","2023-06 (Varna)","","","`#105372 <https://github.com/llvm/llvm-project/issues/105372>`__",""
-"`P1885R12 <https://wg21.link/P1885R12>`__","Naming Text Encodings to Demystify Them","2023-06 (Varna)","|Partial|","22","`#105373 <https://github.com/llvm/llvm-project/issues/105373>`__","locale::encoding() is not yet implemented."
+"`P1885R12 <https://wg21.link/P1885R12>`__","Naming Text Encodings to Demystify Them","2023-06 (Varna)","|Partial|","23","`#105373 <https://github.com/llvm/llvm-project/issues/105373>`__","locale::encoding() is not yet implemented."
"`P0792R14 <https://wg21.link/P0792R14>`__","``function_ref``: a type-erased callable reference","2023-06 (Varna)","","","`#105376 <https://github.com/llvm/llvm-project/issues/105376>`__",""
"`P2874R2 <https://wg21.link/P2874R2>`__","P2874R2: Mandating Annex D Require No More","2023-06 (Varna)","|Complete|","12","`#105377 <https://github.com/llvm/llvm-project/issues/105377>`__",""
"`P2757R3 <https://wg21.link/P2757R3>`__","Type-checking format args","2023-06 (Varna)","","","`#105378 <https://github.com/llvm/llvm-project/issues/105378>`__",""
@@ -79,7 +79,7 @@
"`P3136R1 <https://wg21.link/P3136R1>`__","Retiring niebloids","2024-11 (Wrocław)","|Complete|","14","`#118133 <https://github.com/llvm/llvm-project/issues/118133>`__",""
"`P3138R5 <https://wg21.link/P3138R5>`__","``views::cache_latest``","2024-11 (Wrocław)","","","`#118134 <https://github.com/llvm/llvm-project/issues/118134>`__",""
"`P3379R0 <https://wg21.link/P3379R0>`__","Constrain ``std::expected`` equality operators","2024-11 (Wrocław)","|Complete|","21","`#118135 <https://github.com/llvm/llvm-project/issues/118135>`__",""
-"`P2862R1 <https://wg21.link/P2862R1>`__","``text_encoding::name()`` should never return null values","2024-11 (Wrocław)","|Complete|","22","`#118371 <https://github.com/llvm/llvm-project/issues/118371>`__",""
+"`P2862R1 <https://wg21.link/P2862R1>`__","``text_encoding::name()`` should never return null values","2024-11 (Wrocław)","|Complete|","23","`#118371 <https://github.com/llvm/llvm-project/issues/118371>`__",""
"`P2897R7 <https://wg21.link/P2897R7>`__","``aligned_accessor``: An ``mdspan`` accessor expressing pointer over-alignment","2024-11 (Wrocław)","|Complete|","21","`#118372 <https://github.com/llvm/llvm-project/issues/118372>`__",""
"`P3355R2 <https://wg21.link/P3355R2>`__","Fix ``submdspan`` for C++26","2024-11 (Wrocław)","","","`#118373 <https://github.com/llvm/llvm-project/issues/118373>`__",""
"`P3222R0 <https://wg21.link/P3222R0>`__","Fix C++26 by adding transposed special cases for P2642 layouts","2024-11 (Wrocław)","","","`#118374 <https://github.com/llvm/llvm-project/issues/118374>`__",""
diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h
index cd79036b9db68..37b329bb0bf6c 100644
--- a/libcxx/include/__configuration/availability.h
+++ b/libcxx/include/__configuration/availability.h
@@ -38,6 +38,8 @@
// When availability annotations are disabled, we take for granted that features introduced
// in all versions of the library are available.
#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+# define _LIBCPP_INTRODUCED_IN_LLVM_23 1
+# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */
# define _LIBCPP_INTRODUCED_IN_LLVM_22 1
# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */
@@ -70,6 +72,9 @@
// clang-format off
+# define _LIBCPP_INTRODUCED_IN_LLVM_23 0
+# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE __attribute__((unavailable))
+
// LLVM 22
# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
@@ -295,8 +300,8 @@
// No attribute, since we've had bad_function_call::what() in the headers before
// Controls whether the internal implementation for text_encoding::environment() -> te_impl::__environment() is available
-#define _LIBCPP_AVAILABILITY_HAS_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22
-#define _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
+#define _LIBCPP_AVAILABILITY_HAS_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23
+#define _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE
// Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older
# if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8
diff --git a/libcxx/utils/libcxx/test/features/availability.py b/libcxx/utils/libcxx/test/features/availability.py
index cf491e27dcef7..8a6694cf6ae1c 100644
--- a/libcxx/utils/libcxx/test/features/availability.py
+++ b/libcxx/utils/libcxx/test/features/availability.py
@@ -200,7 +200,7 @@
Feature(
name="availability-te-environment-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && !_target-has-llvm-22)",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && !_target-has-llvm-23)",
cfg.available_features,
),
),
>From df749f528913b81bef60c642b72619b349fe4bfc Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Sat, 7 Feb 2026 16:26:07 -0500
Subject: [PATCH 03/17] Improve struct size, 72 bytes -> 66 bytes on 64bit
system
---
libcxx/include/__text_encoding/te_impl.h | 88 ++++++++++---------
.../text_encoding.ctor/assert.id.pass.cpp | 18 ++--
.../assert.string_view.pass.cpp | 4 +-
3 files changed, 57 insertions(+), 53 deletions(-)
diff --git a/libcxx/include/__text_encoding/te_impl.h b/libcxx/include/__text_encoding/te_impl.h
index 2192735b027fa..9ecfd3c244d81 100644
--- a/libcxx/include/__text_encoding/te_impl.h
+++ b/libcxx/include/__text_encoding/te_impl.h
@@ -295,6 +295,9 @@ struct __te_impl {
CP50220 = 2260
};
+ static constexpr int __NATS_DANO_ = 33;
+ static constexpr int __NATS_DANO_ADD_ = 34;
+
using enum __id;
static constexpr size_t __max_name_length_ = 63;
@@ -310,11 +313,11 @@ struct __te_impl {
__comp_name(string_view(__e.__name_, __e.__name_size_), string_view(__other.__name_, __e.__name_size_));
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __te_data& __e, const int_least32_t __i) noexcept {
- return __e.__mib_rep_ < __i;
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __te_data& __e, __id __i) noexcept {
+ return __e.__mib_rep_ < int_least32_t(__i);
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, std::string_view __name) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, string_view __name) noexcept {
return __comp_name(__name, string_view(__e.__name_, __e.__name_size_));
}
}; // __te_data
@@ -326,16 +329,19 @@ struct __te_impl {
// Map any non-alphanumeric character to 255, skip prefix 0s, else get tolower(__n).
auto __map_char = [](char __n, bool& __in_number) -> unsigned char {
- auto __to_lower = [](char __n_in) -> char {
- return (__n_in >= 'A' && __n_in <= 'Z') ? __n_in + ('a' - 'A') : __n_in;
- };
if (__n == '0') {
return __in_number ? '0' : 255;
}
__in_number = __n >= '1' && __n <= '9';
- return (__n >= '1' && __n <= '9') || (__n >= 'A' && __n <= 'Z') || (__n >= 'a' && __n <= 'z')
- ? __to_lower(__n)
- : 255;
+
+ if ((__n >= '1' && __n <= '9') || (__n >= 'a' && __n <= 'z')) {
+ return __n;
+ }
+ if (__n >= 'A' && __n <= 'Z') {
+ return __n + ('a' - 'A'); // tolower
+ }
+
+ return 255;
};
auto __a_ptr = __a.begin(), __b_ptr = __b.begin();
@@ -358,51 +364,52 @@ struct __te_impl {
return true;
}
- _LIBCPP_HIDE_FROM_ABI static constexpr const __te_data* __find_encoding_data(string_view __a) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __a.size() <= __max_name_length_ && !__a.contains('\0'), "invalid string passed to text_encoding(string_view)");
- const __te_data* __data_first = __text_encoding_data + 2;
- const __te_data* __data_last = std::end(__text_encoding_data);
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx(string_view __a) {
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__a.size() <= __max_name_length_, "input string_view must have size <= 63");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__a.contains('\0'), "input string_view must not contain '\\0'");
- auto* __found_data = std::find(__data_first, __data_last, __a);
+ auto* __found = std::find(__text_encoding_data + 2, std::end(__text_encoding_data), __a);
- if (__found_data == __data_last) {
- return __text_encoding_data; // other
+ if (__found == std::end(__text_encoding_data)) {
+ return 0u; // other
}
- while (__found_data[-1].__mib_rep_ == __found_data->__mib_rep_) {
- __found_data--;
+ while (__found[-1].__mib_rep_ == __found->__mib_rep_) {
+ __found--;
}
- return __found_data;
+ return __found - __text_encoding_data;
}
- _LIBCPP_HIDE_FROM_ABI static constexpr const __te_data* __find_encoding_data_by_id(__id __i) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- ((__i >= __id::other && __i <= __id::CP50220) && ((int_least32_t(__i) != 33) && (int_least32_t(__i) != 34))),
- "invalid text_encoding::id passed to text_encoding(id)");
- auto __found =
- std::lower_bound(std::begin(__text_encoding_data), std::end(__text_encoding_data), int_least32_t(__i));
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx_by_id(__id __i) {
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i >= __id::other, "invalid text_encoding::id passed");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i <= __id::CP50220, "invalid text_encoding::id passed");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __NATS_DANO_, "Mib for NATS-DANO used");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __NATS_DANO_ADD_, "Mib for NATS-DANO-ADD used");
+ auto __found = std::lower_bound(std::begin(__text_encoding_data), std::end(__text_encoding_data), __i);
- return __found != std::end(__text_encoding_data)
- ? __found
- : __text_encoding_data + 1; // unknown, should be unreachable
+ if (__found == std::end(__text_encoding_data)) {
+ return 1u;
+ }
+
+ return __found - __text_encoding_data;
}
_LIBCPP_HIDE_FROM_ABI constexpr __te_impl() = default;
_LIBCPP_HIDE_FROM_ABI constexpr explicit __te_impl(string_view __enc) noexcept
- : __encoding_rep_(__find_encoding_data(__enc)) {
+ : __encoding_idx_(__find_data_idx(__enc)) {
__enc.copy(__name_, __max_name_length_, 0);
}
- _LIBCPP_HIDE_FROM_ABI constexpr __te_impl(__id __i) noexcept : __encoding_rep_(__find_encoding_data_by_id(__i)) {
- if (__encoding_rep_->__name_[0] != '\0')
- std::copy_n(__encoding_rep_->__name_, __encoding_rep_->__name_size_, __name_);
+ _LIBCPP_HIDE_FROM_ABI constexpr __te_impl(__id __i) noexcept : __encoding_idx_(__find_data_idx_by_id(__i)) {
+ if (__text_encoding_data[__encoding_idx_].__name_[0] != '\0')
+ std::copy_n(
+ __text_encoding_data[__encoding_idx_].__name_, __text_encoding_data[__encoding_idx_].__name_size_, __name_);
}
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __id __mib() const noexcept {
- return __id(__encoding_rep_->__mib_rep_);
+ return __id(__text_encoding_data[__encoding_idx_].__mib_rep_);
}
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr const char* __name() const noexcept { return __name_; }
@@ -475,7 +482,7 @@ struct __te_impl {
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) { return operator+=(-__n); }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) { return (*this += -__n); }
_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const __iterator& __it) const { return __data_ == __it.__data_; }
@@ -499,10 +506,10 @@ struct __te_impl {
_LIBCPP_HIDE_FROM_ABI constexpr __aliases_view(const __te_data* __d) : __view_data_(__d) {}
const __te_data* __view_data_;
- };
+ }; // __aliases_view
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view __aliases() const {
- return __aliases_view(__encoding_rep_);
+ return __aliases_view(&__text_encoding_data[__encoding_idx_]);
}
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __a, const __te_impl& __b) noexcept {
@@ -511,7 +518,7 @@ struct __te_impl {
: __a.__mib() == __b.__mib();
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __encoding, const __id __i) noexcept {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __encoding, __id __i) noexcept {
return __encoding.__mib() == __i;
}
@@ -541,9 +548,8 @@ struct __te_impl {
}
# endif
-
- const __te_data* __encoding_rep_ = __text_encoding_data + 1;
- char __name_[__max_name_length_ + 1] = {0};
+ unsigned short __encoding_idx_{1u};
+ char __name_[__max_name_length_ + 1]{};
_LIBCPP_HIDE_FROM_ABI static constexpr __te_data __text_encoding_data[] = {
{"", 1, 0, 0}, // other
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
index e1c966902a343..a2884b941dcf2 100644
--- a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.id.pass.cpp
@@ -19,16 +19,14 @@
#include "check_assertion.h"
int main(int, char**) {
- // Make sure that text_encoding(id) asserts when the input id not in range of allowed values
-
- TEST_LIBCPP_ASSERT_FAILURE(
- std::text_encoding(std::text_encoding::id(33)), "invalid text_encoding::id passed to text_encoding(id)");
- TEST_LIBCPP_ASSERT_FAILURE(
- std::text_encoding(std::text_encoding::id(34)), "invalid text_encoding::id passed to text_encoding(id)");
- TEST_LIBCPP_ASSERT_FAILURE(
- std::text_encoding(std::text_encoding::id(-1)), "invalid text_encoding::id passed to text_encoding(id)");
- TEST_LIBCPP_ASSERT_FAILURE(
- std::text_encoding(std::text_encoding::id(INT_MAX)), "invalid text_encoding::id passed to text_encoding(id)");
+ // Make sure that text_encoding(id) asserts when the input id not in the range of allowed values
+
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(std::text_encoding::id(33)), "Mib for NATS-DANO used");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(std::text_encoding::id(34)), "Mib for NATS-DANO-ADD used");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(std::text_encoding::id(-1)), "invalid text_encoding::id passed");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(std::text_encoding::id(INT_MAX)), "invalid text_encoding::id passed");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(std::text_encoding::id(int(std::text_encoding::id::CP50220) + 1)),
+ "invalid text_encoding::id passed");
return 0;
}
diff --git a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
index 75bee493bbf68..3d50bdd4832f3 100644
--- a/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
+++ b/libcxx/test/libcxx/utilities/text_encoding/text_encoding.ctor/assert.string_view.pass.cpp
@@ -24,14 +24,14 @@ int main(int, char**) {
std::string_view view(str);
// text_encoding(string_view) asserts if its input size() > max_name_length
- TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view), "invalid string passed to text_encoding(string_view)");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view), "input string_view must have size <= 63");
// text_encoding(string_view) asserts if its input contains a null terminator
char str2[std::text_encoding::max_name_length] = "HELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELLOHELL";
std::string_view view2(str2);
str2[3] = '\0';
- TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view2), "invalid string passed to text_encoding(string_view)");
+ TEST_LIBCPP_ASSERT_FAILURE(std::text_encoding(view2), "input string_view must not contain '\\0'");
return 0;
}
>From 01fc9905f47b05ebe988f16392d718eebf830b6b Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Sat, 7 Feb 2026 16:51:29 -0500
Subject: [PATCH 04/17] Update locale for AIX, picolibc
---
libcxx/include/__locale_dir/support/aix.h | 6 ++++++
libcxx/include/__locale_dir/support/newlib.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/libcxx/include/__locale_dir/support/aix.h b/libcxx/include/__locale_dir/support/aix.h
index a216e28393799..86c44adea3846 100644
--- a/libcxx/include/__locale_dir/support/aix.h
+++ b/libcxx/include/__locale_dir/support/aix.h
@@ -17,6 +17,7 @@
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
+#include <langinfo.h>
#include <string.h>
#include <time.h>
#if _LIBCPP_HAS_WIDE_CHARACTERS
@@ -56,6 +57,7 @@ struct __locale_guard {
#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
#define _LIBCPP_ALL_MASK LC_ALL_MASK
#define _LIBCPP_LC_ALL LC_ALL
+#define _LIBCPP_NL_CODESET CODESET
// Get MB_CUE_MAX before __locale_t is defined because it uses a defferent definition in <sys/localedef.h>.
inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __mb_cur_max() { return MB_CUR_MAX; }
@@ -79,6 +81,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
__locale_guard __current(__loc);
return std::localeconv();
}
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __nl_langinfo_l(decltype(_LIBCPP_NL_CODESET) __item, __locale_t __loc) {
+ return ::nl_langinfo_l(__item, __loc);
+}
#endif // _LIBCPP_BUILDING_LIBRARY
// The following structure is a quick-and-dirty workaround for routines that AIX
diff --git a/libcxx/include/__locale_dir/support/newlib.h b/libcxx/include/__locale_dir/support/newlib.h
index 05c8a449cfb05..1e2a3310f74da 100644
--- a/libcxx/include/__locale_dir/support/newlib.h
+++ b/libcxx/include/__locale_dir/support/newlib.h
@@ -16,6 +16,7 @@
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
+#include <langinfo.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
@@ -56,6 +57,7 @@ struct __locale_guard {
#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
#define _LIBCPP_ALL_MASK LC_ALL_MASK
#define _LIBCPP_LC_ALL LC_ALL
+#define _LIBCPP_NL_CODESET CODESET
using __locale_t _LIBCPP_NODEBUG = ::locale_t;
@@ -76,6 +78,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
__locale_guard __current(__loc);
return std::localeconv();
}
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __nl_langinfo_l(decltype(_LIBCPP_NL_CODESET) __item, __locale_t __loc) {
+ return ::nl_langinfo_l(__item, __loc);
+}
#endif // _LIBCPP_BUILDING_LIBRARY
//
>From 0c3d432b9eee551b60f8af0b818e9b268c46fe6f Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 9 Feb 2026 22:31:02 -0500
Subject: [PATCH 05/17] Reduce __te_data struct size from 16B -> 6B, reduces
data table size from 14144 Bytes -> 8620 Bytes
---
libcxx/include/__iterator/wrap_iter.h | 1 +
libcxx/include/__text_encoding/te_impl.h | 1897 +++++++++++-----------
2 files changed, 972 insertions(+), 926 deletions(-)
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 128aeab3ac7cd..a1c8235a46c29 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -119,6 +119,7 @@ class __wrap_iter {
friend struct array;
template <class _Tp, class>
friend struct __optional_iterator;
+ friend struct __te_impl;
};
template <class _Iter1>
diff --git a/libcxx/include/__text_encoding/te_impl.h b/libcxx/include/__text_encoding/te_impl.h
index 9ecfd3c244d81..4c20847b6bc89 100644
--- a/libcxx/include/__text_encoding/te_impl.h
+++ b/libcxx/include/__text_encoding/te_impl.h
@@ -10,8 +10,7 @@
#ifndef _LIBCPP__TEXT_ENCODING_TE_IMPL_H
#define _LIBCPP__TEXT_ENCODING_TE_IMPL_H
-#include <__algorithm/copy_n.h>
-#include <__algorithm/find.h>
+#include <__algorithm/find_if.h>
#include <__algorithm/lower_bound.h>
#include <__config>
#include <__cstddef/ptrdiff_t.h>
@@ -300,27 +299,23 @@ struct __te_impl {
using enum __id;
static constexpr size_t __max_name_length_ = 63;
-
struct __te_data {
- const char* __name_;
- int_least32_t __mib_rep_;
- uint16_t __name_size_;
- uint16_t __to_end_;
- // The encoding data knows the end of its range to simplify iterator implementation.
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, const __te_data& __other) noexcept {
- return __e.__mib_rep_ == __other.__mib_rep_ ||
- __comp_name(string_view(__e.__name_, __e.__name_size_), string_view(__other.__name_, __e.__name_size_));
+ unsigned short __first_alias_index_;
+ unsigned short __mib_rep_;
+ unsigned char __num_aliases_;
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __te_data& __enc, __id __i) noexcept {
+ return __enc.__mib_rep_ < static_cast<unsigned short>(__i);
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __te_data& __e, __id __i) noexcept {
- return __e.__mib_rep_ < int_least32_t(__i);
+ _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_begin() const {
+ return &__aliases_table[__first_alias_index_];
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_data& __e, string_view __name) noexcept {
- return __comp_name(__name, string_view(__e.__name_, __e.__name_size_));
+ _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_end() const {
+ return &__aliases_table[__first_alias_index_ + __num_aliases_];
}
- }; // __te_data
+ };
_LIBCPP_HIDE_FROM_ABI static constexpr bool __comp_name(string_view __a, string_view __b) {
if (__a.empty() || __b.empty()) {
@@ -368,17 +363,19 @@ struct __te_impl {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__a.size() <= __max_name_length_, "input string_view must have size <= 63");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__a.contains('\0'), "input string_view must not contain '\\0'");
- auto* __found = std::find(__text_encoding_data + 2, std::end(__text_encoding_data), __a);
+ auto __pred = [&__a](const __te_data& __entry) -> bool {
+ // Search slice of alias table that corresponds to the current MIB
+ return std::find_if(__entry.__aliases_begin(), __entry.__aliases_end(), [&__a](const char* __alias) {
+ return __comp_name(__a, __alias);
+ }) != __entry.__aliases_end();
+ };
- if (__found == std::end(__text_encoding_data)) {
+ const __te_data* __found = std::find_if(__entries + 2, std::end(__entries), __pred);
+ if (__found == std::end(__entries)) {
return 0u; // other
}
- while (__found[-1].__mib_rep_ == __found->__mib_rep_) {
- __found--;
- }
-
- return __found - __text_encoding_data;
+ return __found - __entries;
}
_LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx_by_id(__id __i) {
@@ -386,13 +383,13 @@ struct __te_impl {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i <= __id::CP50220, "invalid text_encoding::id passed");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __NATS_DANO_, "Mib for NATS-DANO used");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __NATS_DANO_ADD_, "Mib for NATS-DANO-ADD used");
- auto __found = std::lower_bound(std::begin(__text_encoding_data), std::end(__text_encoding_data), __i);
+ auto __found = std::lower_bound(std::begin(__entries), std::end(__entries), __i);
- if (__found == std::end(__text_encoding_data)) {
- return 1u;
+ if (__found == std::end(__entries)) {
+ return 1u; // unknown
}
- return __found - __text_encoding_data;
+ return __found - __entries;
}
_LIBCPP_HIDE_FROM_ABI constexpr __te_impl() = default;
@@ -403,14 +400,16 @@ struct __te_impl {
}
_LIBCPP_HIDE_FROM_ABI constexpr __te_impl(__id __i) noexcept : __encoding_idx_(__find_data_idx_by_id(__i)) {
- if (__text_encoding_data[__encoding_idx_].__name_[0] != '\0')
- std::copy_n(
- __text_encoding_data[__encoding_idx_].__name_, __text_encoding_data[__encoding_idx_].__name_size_, __name_);
+ const char* __alias = __aliases_table[__entries[__encoding_idx_].__first_alias_index_];
+ if (__alias[0] != '\0') {
+ string_view(__alias).copy(__name_, __max_name_length_);
+ }
}
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __id __mib() const noexcept {
- return __id(__text_encoding_data[__encoding_idx_].__mib_rep_);
+ return __id(__entries[__encoding_idx_].__mib_rep_);
}
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr const char* __name() const noexcept { return __name_; }
// [text.encoding.aliases], class text_encoding::aliases_view
@@ -424,13 +423,15 @@ struct __te_impl {
constexpr __iterator() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return __data_->__name_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return *__data_; }
- _LIBCPP_HIDE_FROM_ABI constexpr value_type operator[](difference_type __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
auto __it = *this;
return *(__it + __n);
}
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator->() const { return __data_; }
+
_LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __it, difference_type __n) {
__it += __n;
return __it;
@@ -491,15 +492,13 @@ struct __te_impl {
private:
friend struct __aliases_view;
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(const __te_data* __enc_d) noexcept : __data_(__enc_d) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(const char* const* __enc_d) noexcept : __data_(__enc_d) {}
- const __te_data* __data_;
+ const char* const* __data_;
}; // __iterator
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__view_data_}; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const {
- return __iterator{__view_data_ + __view_data_->__to_end_};
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__view_data_->__aliases_begin()}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const { return __iterator{__view_data_->__aliases_end()}; }
private:
friend struct __te_impl;
@@ -509,7 +508,7 @@ struct __te_impl {
}; // __aliases_view
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view __aliases() const {
- return __aliases_view(&__text_encoding_data[__encoding_idx_]);
+ return __aliases_view(&__entries[__encoding_idx_]);
}
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __te_impl& __a, const __te_impl& __b) noexcept {
@@ -551,891 +550,937 @@ struct __te_impl {
unsigned short __encoding_idx_{1u};
char __name_[__max_name_length_ + 1]{};
- _LIBCPP_HIDE_FROM_ABI static constexpr __te_data __text_encoding_data[] = {
- {"", 1, 0, 0}, // other
- {"", 2, 0, 0}, // unknown
- {"US-ASCII", 3, 8, 11},
- {"iso-ir-6", 3, 8, 10},
- {"ANSI_X3.4-1968", 3, 14, 9},
- {"ANSI_X3.4-1986", 3, 14, 8},
- {"ISO_646.irv:1991", 3, 16, 7},
- {"ISO646-US", 3, 9, 6},
- {"us", 3, 2, 5},
- {"IBM367", 3, 6, 4},
- {"cp367", 3, 5, 3},
- {"csASCII", 3, 7, 2},
- {"ASCII", 3, 5, 1},
- {"ISO_8859-1:1987", 4, 15, 9},
- {"iso-ir-100", 4, 10, 8},
- {"ISO_8859-1", 4, 10, 7},
- {"ISO-8859-1", 4, 10, 6},
- {"latin1", 4, 6, 5},
- {"l1", 4, 2, 4},
- {"IBM819", 4, 6, 3},
- {"CP819", 4, 5, 2},
- {"csISOLatin1", 4, 11, 1},
- {"ISO_8859-2:1987", 5, 15, 7},
- {"iso-ir-101", 5, 10, 6},
- {"ISO_8859-2", 5, 10, 5},
- {"ISO-8859-2", 5, 10, 4},
- {"latin2", 5, 6, 3},
- {"l2", 5, 2, 2},
- {"csISOLatin2", 5, 11, 1},
- {"ISO_8859-3:1988", 6, 15, 7},
- {"iso-ir-109", 6, 10, 6},
- {"ISO_8859-3", 6, 10, 5},
- {"ISO-8859-3", 6, 10, 4},
- {"latin3", 6, 6, 3},
- {"l3", 6, 2, 2},
- {"csISOLatin3", 6, 11, 1},
- {"ISO_8859-4:1988", 7, 15, 7},
- {"iso-ir-110", 7, 10, 6},
- {"ISO_8859-4", 7, 10, 5},
- {"ISO-8859-4", 7, 10, 4},
- {"latin4", 7, 6, 3},
- {"l4", 7, 2, 2},
- {"csISOLatin4", 7, 11, 1},
- {"ISO_8859-5:1988", 8, 15, 6},
- {"iso-ir-144", 8, 10, 5},
- {"ISO_8859-5", 8, 10, 4},
- {"ISO-8859-5", 8, 10, 3},
- {"cyrillic", 8, 8, 2},
- {"csISOLatinCyrillic", 8, 18, 1},
- {"ISO_8859-6:1987", 9, 15, 8},
- {"iso-ir-127", 9, 10, 7},
- {"ISO_8859-6", 9, 10, 6},
- {"ISO-8859-6", 9, 10, 5},
- {"ECMA-114", 9, 8, 4},
- {"ASMO-708", 9, 8, 3},
- {"arabic", 9, 6, 2},
- {"csISOLatinArabic", 9, 16, 1},
- {"ISO_8859-7:1987", 10, 15, 9},
- {"iso-ir-126", 10, 10, 8},
- {"ISO_8859-7", 10, 10, 7},
- {"ISO-8859-7", 10, 10, 6},
- {"ELOT_928", 10, 8, 5},
- {"ECMA-118", 10, 8, 4},
- {"greek", 10, 5, 3},
- {"greek8", 10, 6, 2},
- {"csISOLatinGreek", 10, 15, 1},
- {"ISO_8859-8:1988", 11, 15, 6},
- {"iso-ir-138", 11, 10, 5},
- {"ISO_8859-8", 11, 10, 4},
- {"ISO-8859-8", 11, 10, 3},
- {"hebrew", 11, 6, 2},
- {"csISOLatinHebrew", 11, 16, 1},
- {"ISO_8859-9:1989", 12, 15, 7},
- {"iso-ir-148", 12, 10, 6},
- {"ISO_8859-9", 12, 10, 5},
- {"ISO-8859-9", 12, 10, 4},
- {"latin5", 12, 6, 3},
- {"l5", 12, 2, 2},
- {"csISOLatin5", 12, 11, 1},
- {"ISO-8859-10", 13, 11, 6},
- {"iso-ir-157", 13, 10, 5},
- {"l6", 13, 2, 4},
- {"ISO_8859-10:1992", 13, 16, 3},
- {"csISOLatin6", 13, 11, 2},
- {"latin6", 13, 6, 1},
- {"ISO_6937-2-add", 14, 14, 3},
- {"iso-ir-142", 14, 10, 2},
- {"csISOTextComm", 14, 13, 1},
- {"JIS_X0201", 15, 9, 3},
- {"X0201", 15, 5, 2},
- {"csHalfWidthKatakana", 15, 19, 1},
- {"JIS_Encoding", 16, 12, 2},
- {"csJISEncoding", 16, 13, 1},
- {"Shift_JIS", 17, 9, 3},
- {"MS_Kanji", 17, 8, 2},
- {"csShiftJIS", 17, 10, 1},
- {"Extended_UNIX_Code_Packed_Format_for_Japanese", 18, 45, 3},
- {"csEUCPkdFmtJapanese", 18, 19, 2},
- {"EUC-JP", 18, 6, 1},
- {"Extended_UNIX_Code_Fixed_Width_for_Japanese", 19, 43, 2},
- {"csEUCFixWidJapanese", 19, 19, 1},
- {"BS_4730", 20, 7, 6},
- {"iso-ir-4", 20, 8, 5},
- {"ISO646-GB", 20, 9, 4},
- {"gb", 20, 2, 3},
- {"uk", 20, 2, 2},
- {"csISO4UnitedKingdom", 20, 19, 1},
- {"SEN_850200_C", 21, 12, 5},
- {"iso-ir-11", 21, 9, 4},
- {"ISO646-SE2", 21, 10, 3},
- {"se2", 21, 3, 2},
- {"csISO11SwedishForNames", 21, 22, 1},
- {"IT", 22, 2, 4},
- {"iso-ir-15", 22, 9, 3},
- {"ISO646-IT", 22, 9, 2},
- {"csISO15Italian", 22, 14, 1},
- {"ES", 23, 2, 4},
- {"iso-ir-17", 23, 9, 3},
- {"ISO646-ES", 23, 9, 2},
- {"csISO17Spanish", 23, 14, 1},
- {"DIN_66003", 24, 9, 5},
- {"iso-ir-21", 24, 9, 4},
- {"de", 24, 2, 3},
- {"ISO646-DE", 24, 9, 2},
- {"csISO21German", 24, 13, 1},
- {"NS_4551-1", 25, 9, 6},
- {"iso-ir-60", 25, 9, 5},
- {"ISO646-NO", 25, 9, 4},
- {"no", 25, 2, 3},
- {"csISO60DanishNorwegian", 25, 22, 2},
- {"csISO60Norwegian1", 25, 17, 1},
- {"NF_Z_62-010", 26, 11, 5},
- {"iso-ir-69", 26, 9, 4},
- {"ISO646-FR", 26, 9, 3},
- {"fr", 26, 2, 2},
- {"csISO69French", 26, 13, 1},
- {"ISO-10646-UTF-1", 27, 15, 2},
- {"csISO10646UTF1", 27, 14, 1},
- {"ISO_646.basic:1983", 28, 18, 3},
- {"ref", 28, 3, 2},
- {"csISO646basic1983", 28, 17, 1},
- {"INVARIANT", 29, 9, 2},
- {"csINVARIANT", 29, 11, 1},
- {"ISO_646.irv:1983", 30, 16, 4},
- {"iso-ir-2", 30, 8, 3},
- {"irv", 30, 3, 2},
- {"csISO2IntlRefVersion", 30, 20, 1},
- {"NATS-SEFI", 31, 9, 3},
- {"iso-ir-8-1", 31, 10, 2},
- {"csNATSSEFI", 31, 10, 1},
- {"NATS-SEFI-ADD", 32, 13, 3},
- {"iso-ir-8-2", 32, 10, 2},
- {"csNATSSEFIADD", 32, 13, 1},
- {"SEN_850200_B", 35, 12, 7},
- {"iso-ir-10", 35, 9, 6},
- {"FI", 35, 2, 5},
- {"ISO646-FI", 35, 9, 4},
- {"ISO646-SE", 35, 9, 3},
- {"se", 35, 2, 2},
- {"csISO10Swedish", 35, 14, 1},
- {"KS_C_5601-1987", 36, 14, 6},
- {"iso-ir-149", 36, 10, 5},
- {"KS_C_5601-1989", 36, 14, 4},
- {"KSC_5601", 36, 8, 3},
- {"korean", 36, 6, 2},
- {"csKSC56011987", 36, 13, 1},
- {"ISO-2022-KR", 37, 11, 2},
- {"csISO2022KR", 37, 11, 1},
- {"EUC-KR", 38, 6, 2},
- {"csEUCKR", 38, 7, 1},
- {"ISO-2022-JP", 39, 11, 2},
- {"csISO2022JP", 39, 11, 1},
- {"ISO-2022-JP-2", 40, 13, 2},
- {"csISO2022JP2", 40, 12, 1},
- {"JIS_C6220-1969-jp", 41, 17, 6},
- {"JIS_C6220-1969", 41, 14, 5},
- {"iso-ir-13", 41, 9, 4},
- {"katakana", 41, 8, 3},
- {"x0201-7", 41, 7, 2},
- {"csISO13JISC6220jp", 41, 17, 1},
- {"JIS_C6220-1969-ro", 42, 17, 5},
- {"iso-ir-14", 42, 9, 4},
- {"jp", 42, 2, 3},
- {"ISO646-JP", 42, 9, 2},
- {"csISO14JISC6220ro", 42, 17, 1},
- {"PT", 43, 2, 4},
- {"iso-ir-16", 43, 9, 3},
- {"ISO646-PT", 43, 9, 2},
- {"csISO16Portuguese", 43, 17, 1},
- {"greek7-old", 44, 10, 3},
- {"iso-ir-18", 44, 9, 2},
- {"csISO18Greek7Old", 44, 16, 1},
- {"latin-greek", 45, 11, 3},
- {"iso-ir-19", 45, 9, 2},
- {"csISO19LatinGreek", 45, 17, 1},
- {"NF_Z_62-010_(1973)", 46, 18, 4},
- {"iso-ir-25", 46, 9, 3},
- {"ISO646-FR1", 46, 10, 2},
- {"csISO25French", 46, 13, 1},
- {"Latin-greek-1", 47, 13, 3},
- {"iso-ir-27", 47, 9, 2},
- {"csISO27LatinGreek1", 47, 18, 1},
- {"ISO_5427", 48, 8, 3},
- {"iso-ir-37", 48, 9, 2},
- {"csISO5427Cyrillic", 48, 17, 1},
- {"JIS_C6226-1978", 49, 14, 3},
- {"iso-ir-42", 49, 9, 2},
- {"csISO42JISC62261978", 49, 19, 1},
- {"BS_viewdata", 50, 11, 3},
- {"iso-ir-47", 50, 9, 2},
- {"csISO47BSViewdata", 50, 17, 1},
- {"INIS", 51, 4, 3},
- {"iso-ir-49", 51, 9, 2},
- {"csISO49INIS", 51, 11, 1},
- {"INIS-8", 52, 6, 3},
- {"iso-ir-50", 52, 9, 2},
- {"csISO50INIS8", 52, 12, 1},
- {"INIS-cyrillic", 53, 13, 3},
- {"iso-ir-51", 53, 9, 2},
- {"csISO51INISCyrillic", 53, 19, 1},
- {"ISO_5427:1981", 54, 13, 4},
- {"iso-ir-54", 54, 9, 3},
- {"ISO5427Cyrillic1981", 54, 19, 2},
- {"csISO54271981", 54, 13, 1},
- {"ISO_5428:1980", 55, 13, 3},
- {"iso-ir-55", 55, 9, 2},
- {"csISO5428Greek", 55, 14, 1},
- {"GB_1988-80", 56, 10, 5},
- {"iso-ir-57", 56, 9, 4},
- {"cn", 56, 2, 3},
- {"ISO646-CN", 56, 9, 2},
- {"csISO57GB1988", 56, 13, 1},
- {"GB_2312-80", 57, 10, 4},
- {"iso-ir-58", 57, 9, 3},
- {"chinese", 57, 7, 2},
- {"csISO58GB231280", 57, 15, 1},
- {"NS_4551-2", 58, 9, 5},
- {"ISO646-NO2", 58, 10, 4},
- {"iso-ir-61", 58, 9, 3},
- {"no2", 58, 3, 2},
- {"csISO61Norwegian2", 58, 17, 1},
- {"videotex-suppl", 59, 14, 3},
- {"iso-ir-70", 59, 9, 2},
- {"csISO70VideotexSupp1", 59, 20, 1},
- {"PT2", 60, 3, 4},
- {"iso-ir-84", 60, 9, 3},
- {"ISO646-PT2", 60, 10, 2},
- {"csISO84Portuguese2", 60, 18, 1},
- {"ES2", 61, 3, 4},
- {"iso-ir-85", 61, 9, 3},
- {"ISO646-ES2", 61, 10, 2},
- {"csISO85Spanish2", 61, 15, 1},
- {"MSZ_7795.3", 62, 10, 5},
- {"iso-ir-86", 62, 9, 4},
- {"ISO646-HU", 62, 9, 3},
- {"hu", 62, 2, 2},
- {"csISO86Hungarian", 62, 16, 1},
- {"JIS_C6226-1983", 63, 14, 5},
- {"iso-ir-87", 63, 9, 4},
- {"x0208", 63, 5, 3},
- {"JIS_X0208-1983", 63, 14, 2},
- {"csISO87JISX0208", 63, 15, 1},
- {"greek7", 64, 6, 3},
- {"iso-ir-88", 64, 9, 2},
- {"csISO88Greek7", 64, 13, 1},
- {"ASMO_449", 65, 8, 5},
- {"ISO_9036", 65, 8, 4},
- {"arabic7", 65, 7, 3},
- {"iso-ir-89", 65, 9, 2},
- {"csISO89ASMO449", 65, 14, 1},
- {"iso-ir-90", 66, 9, 2},
- {"csISO90", 66, 7, 1},
- {"JIS_C6229-1984-a", 67, 16, 4},
- {"iso-ir-91", 67, 9, 3},
- {"jp-ocr-a", 67, 8, 2},
- {"csISO91JISC62291984a", 67, 20, 1},
- {"JIS_C6229-1984-b", 68, 16, 5},
- {"iso-ir-92", 68, 9, 4},
- {"ISO646-JP-OCR-B", 68, 15, 3},
- {"jp-ocr-b", 68, 8, 2},
- {"csISO92JISC62991984b", 68, 20, 1},
- {"JIS_C6229-1984-b-add", 69, 20, 4},
- {"iso-ir-93", 69, 9, 3},
- {"jp-ocr-b-add", 69, 12, 2},
- {"csISO93JIS62291984badd", 69, 22, 1},
- {"JIS_C6229-1984-hand", 70, 19, 4},
- {"iso-ir-94", 70, 9, 3},
- {"jp-ocr-hand", 70, 11, 2},
- {"csISO94JIS62291984hand", 70, 22, 1},
- {"JIS_C6229-1984-hand-add", 71, 23, 4},
- {"iso-ir-95", 71, 9, 3},
- {"jp-ocr-hand-add", 71, 15, 2},
- {"csISO95JIS62291984handadd", 71, 25, 1},
- {"JIS_C6229-1984-kana", 72, 19, 3},
- {"iso-ir-96", 72, 9, 2},
- {"csISO96JISC62291984kana", 72, 23, 1},
- {"ISO_2033-1983", 73, 13, 4},
- {"iso-ir-98", 73, 9, 3},
- {"e13b", 73, 4, 2},
- {"csISO2033", 73, 9, 1},
- {"ANSI_X3.110-1983", 74, 16, 5},
- {"iso-ir-99", 74, 9, 4},
- {"CSA_T500-1983", 74, 13, 3},
- {"NAPLPS", 74, 6, 2},
- {"csISO99NAPLPS", 74, 13, 1},
- {"T.61-7bit", 75, 9, 3},
- {"iso-ir-102", 75, 10, 2},
- {"csISO102T617bit", 75, 15, 1},
- {"T.61-8bit", 76, 9, 4},
- {"T.61", 76, 4, 3},
- {"iso-ir-103", 76, 10, 2},
- {"csISO103T618bit", 76, 15, 1},
- {"ECMA-cyrillic", 77, 13, 4},
- {"iso-ir-111", 77, 10, 3},
- {"KOI8-E", 77, 6, 2},
- {"csISO111ECMACyrillic", 77, 20, 1},
- {"CSA_Z243.4-1985-1", 78, 17, 7},
- {"iso-ir-121", 78, 10, 6},
- {"ISO646-CA", 78, 9, 5},
- {"csa7-1", 78, 6, 4},
- {"csa71", 78, 5, 3},
- {"ca", 78, 2, 2},
- {"csISO121Canadian1", 78, 17, 1},
- {"CSA_Z243.4-1985-2", 79, 17, 6},
- {"iso-ir-122", 79, 10, 5},
- {"ISO646-CA2", 79, 10, 4},
- {"csa7-2", 79, 6, 3},
- {"csa72", 79, 5, 2},
- {"csISO122Canadian2", 79, 17, 1},
- {"CSA_Z243.4-1985-gr", 80, 18, 3},
- {"iso-ir-123", 80, 10, 2},
- {"csISO123CSAZ24341985gr", 80, 22, 1},
- {"ISO_8859-6-E", 81, 12, 3},
- {"csISO88596E", 81, 11, 2},
- {"ISO-8859-6-E", 81, 12, 1},
- {"ISO_8859-6-I", 82, 12, 3},
- {"csISO88596I", 82, 11, 2},
- {"ISO-8859-6-I", 82, 12, 1},
- {"T.101-G2", 83, 8, 3},
- {"iso-ir-128", 83, 10, 2},
- {"csISO128T101G2", 83, 14, 1},
- {"ISO_8859-8-E", 84, 12, 3},
- {"csISO88598E", 84, 11, 2},
- {"ISO-8859-8-E", 84, 12, 1},
- {"ISO_8859-8-I", 85, 12, 3},
- {"csISO88598I", 85, 11, 2},
- {"ISO-8859-8-I", 85, 12, 1},
- {"CSN_369103", 86, 10, 3},
- {"iso-ir-139", 86, 10, 2},
- {"csISO139CSN369103", 86, 17, 1},
- {"JUS_I.B1.002", 87, 12, 6},
- {"iso-ir-141", 87, 10, 5},
- {"ISO646-YU", 87, 9, 4},
- {"js", 87, 2, 3},
- {"yu", 87, 2, 2},
- {"csISO141JUSIB1002", 87, 17, 1},
- {"IEC_P27-1", 88, 9, 3},
- {"iso-ir-143", 88, 10, 2},
- {"csISO143IECP271", 88, 15, 1},
- {"JUS_I.B1.003-serb", 89, 17, 4},
- {"iso-ir-146", 89, 10, 3},
- {"serbian", 89, 7, 2},
- {"csISO146Serbian", 89, 15, 1},
- {"JUS_I.B1.003-mac", 90, 16, 4},
- {"macedonian", 90, 10, 3},
- {"iso-ir-147", 90, 10, 2},
- {"csISO147Macedonian", 90, 18, 1},
- {"greek-ccitt", 91, 11, 4},
- {"iso-ir-150", 91, 10, 3},
- {"csISO150", 91, 8, 2},
- {"csISO150GreekCCITT", 91, 18, 1},
- {"NC_NC00-10:81", 92, 13, 5},
- {"cuba", 92, 4, 4},
- {"iso-ir-151", 92, 10, 3},
- {"ISO646-CU", 92, 9, 2},
- {"csISO151Cuba", 92, 12, 1},
- {"ISO_6937-2-25", 93, 13, 3},
- {"iso-ir-152", 93, 10, 2},
- {"csISO6937Add", 93, 12, 1},
- {"GOST_19768-74", 94, 13, 4},
- {"ST_SEV_358-88", 94, 13, 3},
- {"iso-ir-153", 94, 10, 2},
- {"csISO153GOST1976874", 94, 19, 1},
- {"ISO_8859-supp", 95, 13, 4},
- {"iso-ir-154", 95, 10, 3},
- {"latin1-2-5", 95, 10, 2},
- {"csISO8859Supp", 95, 13, 1},
- {"ISO_10367-box", 96, 13, 3},
- {"iso-ir-155", 96, 10, 2},
- {"csISO10367Box", 96, 13, 1},
- {"latin-lap", 97, 9, 4},
- {"lap", 97, 3, 3},
- {"iso-ir-158", 97, 10, 2},
- {"csISO158Lap", 97, 11, 1},
- {"JIS_X0212-1990", 98, 14, 4},
- {"x0212", 98, 5, 3},
- {"iso-ir-159", 98, 10, 2},
- {"csISO159JISX02121990", 98, 20, 1},
- {"DS_2089", 99, 7, 5},
- {"DS2089", 99, 6, 4},
- {"ISO646-DK", 99, 9, 3},
- {"dk", 99, 2, 2},
- {"csISO646Danish", 99, 14, 1},
- {"us-dk", 100, 5, 2},
- {"csUSDK", 100, 6, 1},
- {"dk-us", 101, 5, 2},
- {"csDKUS", 101, 6, 1},
- {"KSC5636", 102, 7, 3},
- {"ISO646-KR", 102, 9, 2},
- {"csKSC5636", 102, 9, 1},
- {"UNICODE-1-1-UTF-7", 103, 17, 2},
- {"csUnicode11UTF7", 103, 15, 1},
- {"ISO-2022-CN", 104, 11, 2},
- {"csISO2022CN", 104, 11, 1},
- {"ISO-2022-CN-EXT", 105, 15, 2},
- {"csISO2022CNEXT", 105, 14, 1},
- {"UTF-8", 106, 5, 2},
- {"csUTF8", 106, 6, 1},
- {"ISO-8859-13", 109, 11, 2},
- {"csISO885913", 109, 11, 1},
- {"ISO-8859-14", 110, 11, 8},
- {"iso-ir-199", 110, 10, 7},
- {"ISO_8859-14:1998", 110, 16, 6},
- {"ISO_8859-14", 110, 11, 5},
- {"latin8", 110, 6, 4},
- {"iso-celtic", 110, 10, 3},
- {"l8", 110, 2, 2},
- {"csISO885914", 110, 11, 1},
- {"ISO-8859-15", 111, 11, 4},
- {"ISO_8859-15", 111, 11, 3},
- {"Latin-9", 111, 7, 2},
- {"csISO885915", 111, 11, 1},
- {"ISO-8859-16", 112, 11, 7},
- {"iso-ir-226", 112, 10, 6},
- {"ISO_8859-16:2001", 112, 16, 5},
- {"ISO_8859-16", 112, 11, 4},
- {"latin10", 112, 7, 3},
- {"l10", 112, 3, 2},
- {"csISO885916", 112, 11, 1},
- {"GBK", 113, 3, 5},
- {"CP936", 113, 5, 4},
- {"MS936", 113, 5, 3},
- {"windows-936", 113, 11, 2},
- {"csGBK", 113, 5, 1},
- {"GB18030", 114, 7, 2},
- {"csGB18030", 114, 9, 1},
- {"OSD_EBCDIC_DF04_15", 115, 18, 2},
- {"csOSDEBCDICDF0415", 115, 17, 1},
- {"OSD_EBCDIC_DF03_IRV", 116, 19, 2},
- {"csOSDEBCDICDF03IRV", 116, 18, 1},
- {"OSD_EBCDIC_DF04_1", 117, 17, 2},
- {"csOSDEBCDICDF041", 117, 16, 1},
- {"ISO-11548-1", 118, 11, 4},
- {"ISO_11548-1", 118, 11, 3},
- {"ISO_TR_11548-1", 118, 14, 2},
- {"csISO115481", 118, 11, 1},
- {"KZ-1048", 119, 7, 4},
- {"STRK1048-2002", 119, 13, 3},
- {"RK1048", 119, 6, 2},
- {"csKZ1048", 119, 8, 1},
- {"ISO-10646-UCS-2", 1000, 15, 2},
- {"csUnicode", 1000, 9, 1},
- {"ISO-10646-UCS-4", 1001, 15, 2},
- {"csUCS4", 1001, 6, 1},
- {"ISO-10646-UCS-Basic", 1002, 19, 2},
- {"csUnicodeASCII", 1002, 14, 1},
- {"ISO-10646-Unicode-Latin1", 1003, 24, 3},
- {"csUnicodeLatin1", 1003, 15, 2},
- {"ISO-10646", 1003, 9, 1},
- {"ISO-10646-J-1", 1004, 13, 2},
- {"csUnicodeJapanese", 1004, 17, 1},
- {"ISO-Unicode-IBM-1261", 1005, 20, 2},
- {"csUnicodeIBM1261", 1005, 16, 1},
- {"ISO-Unicode-IBM-1268", 1006, 20, 2},
- {"csUnicodeIBM1268", 1006, 16, 1},
- {"ISO-Unicode-IBM-1276", 1007, 20, 2},
- {"csUnicodeIBM1276", 1007, 16, 1},
- {"ISO-Unicode-IBM-1264", 1008, 20, 2},
- {"csUnicodeIBM1264", 1008, 16, 1},
- {"ISO-Unicode-IBM-1265", 1009, 20, 2},
- {"csUnicodeIBM1265", 1009, 16, 1},
- {"UNICODE-1-1", 1010, 11, 2},
- {"csUnicode11", 1010, 11, 1},
- {"SCSU", 1011, 4, 2},
- {"csSCSU", 1011, 6, 1},
- {"UTF-7", 1012, 5, 2},
- {"csUTF7", 1012, 6, 1},
- {"UTF-16BE", 1013, 8, 2},
- {"csUTF16BE", 1013, 9, 1},
- {"UTF-16LE", 1014, 8, 2},
- {"csUTF16LE", 1014, 9, 1},
- {"UTF-16", 1015, 6, 2},
- {"csUTF16", 1015, 7, 1},
- {"CESU-8", 1016, 6, 3},
- {"csCESU8", 1016, 7, 2},
- {"csCESU-8", 1016, 8, 1},
- {"UTF-32", 1017, 6, 2},
- {"csUTF32", 1017, 7, 1},
- {"UTF-32BE", 1018, 8, 2},
- {"csUTF32BE", 1018, 9, 1},
- {"UTF-32LE", 1019, 8, 2},
- {"csUTF32LE", 1019, 9, 1},
- {"BOCU-1", 1020, 6, 3},
- {"csBOCU1", 1020, 7, 2},
- {"csBOCU-1", 1020, 8, 1},
- {"UTF-7-IMAP", 1021, 10, 2},
- {"csUTF7IMAP", 1021, 10, 1},
- {"ISO-8859-1-Windows-3.0-Latin-1", 2000, 30, 2},
- {"csWindows30Latin1", 2000, 17, 1},
- {"ISO-8859-1-Windows-3.1-Latin-1", 2001, 30, 2},
- {"csWindows31Latin1", 2001, 17, 1},
- {"ISO-8859-2-Windows-Latin-2", 2002, 26, 2},
- {"csWindows31Latin2", 2002, 17, 1},
- {"ISO-8859-9-Windows-Latin-5", 2003, 26, 2},
- {"csWindows31Latin5", 2003, 17, 1},
- {"hp-roman8", 2004, 9, 4},
- {"roman8", 2004, 6, 3},
- {"r8", 2004, 2, 2},
- {"csHPRoman8", 2004, 10, 1},
- {"Adobe-Standard-Encoding", 2005, 23, 2},
- {"csAdobeStandardEncoding", 2005, 23, 1},
- {"Ventura-US", 2006, 10, 2},
- {"csVenturaUS", 2006, 11, 1},
- {"Ventura-International", 2007, 21, 2},
- {"csVenturaInternational", 2007, 22, 1},
- {"DEC-MCS", 2008, 7, 3},
- {"dec", 2008, 3, 2},
- {"csDECMCS", 2008, 8, 1},
- {"IBM850", 2009, 6, 4},
- {"cp850", 2009, 5, 3},
- {"850", 2009, 3, 2},
- {"csPC850Multilingual", 2009, 19, 1},
- {"IBM852", 2010, 6, 4},
- {"cp852", 2010, 5, 3},
- {"852", 2010, 3, 2},
- {"csPCp852", 2010, 8, 1},
- {"IBM437", 2011, 6, 4},
- {"cp437", 2011, 5, 3},
- {"437", 2011, 3, 2},
- {"csPC8CodePage437", 2011, 16, 1},
- {"PC8-Danish-Norwegian", 2012, 20, 2},
- {"csPC8DanishNorwegian", 2012, 20, 1},
- {"IBM862", 2013, 6, 4},
- {"cp862", 2013, 5, 3},
- {"862", 2013, 3, 2},
- {"csPC862LatinHebrew", 2013, 18, 1},
- {"PC8-Turkish", 2014, 11, 2},
- {"csPC8Turkish", 2014, 12, 1},
- {"IBM-Symbols", 2015, 11, 2},
- {"csIBMSymbols", 2015, 12, 1},
- {"IBM-Thai", 2016, 8, 2},
- {"csIBMThai", 2016, 9, 1},
- {"HP-Legal", 2017, 8, 2},
- {"csHPLegal", 2017, 9, 1},
- {"HP-Pi-font", 2018, 10, 2},
- {"csHPPiFont", 2018, 10, 1},
- {"HP-Math8", 2019, 8, 2},
- {"csHPMath8", 2019, 9, 1},
- {"Adobe-Symbol-Encoding", 2020, 21, 2},
- {"csHPPSMath", 2020, 10, 1},
- {"HP-DeskTop", 2021, 10, 2},
- {"csHPDesktop", 2021, 11, 1},
- {"Ventura-Math", 2022, 12, 2},
- {"csVenturaMath", 2022, 13, 1},
- {"Microsoft-Publishing", 2023, 20, 2},
- {"csMicrosoftPublishing", 2023, 21, 1},
- {"Windows-31J", 2024, 11, 2},
- {"csWindows31J", 2024, 12, 1},
- {"GB2312", 2025, 6, 2},
- {"csGB2312", 2025, 8, 1},
- {"Big5", 2026, 4, 2},
- {"csBig5", 2026, 6, 1},
- {"macintosh", 2027, 9, 3},
- {"mac", 2027, 3, 2},
- {"csMacintosh", 2027, 11, 1},
- {"IBM037", 2028, 6, 7},
- {"cp037", 2028, 5, 6},
- {"ebcdic-cp-us", 2028, 12, 5},
- {"ebcdic-cp-ca", 2028, 12, 4},
- {"ebcdic-cp-wt", 2028, 12, 3},
- {"ebcdic-cp-nl", 2028, 12, 2},
- {"csIBM037", 2028, 8, 1},
- {"IBM038", 2029, 6, 4},
- {"EBCDIC-INT", 2029, 10, 3},
- {"cp038", 2029, 5, 2},
- {"csIBM038", 2029, 8, 1},
- {"IBM273", 2030, 6, 3},
- {"CP273", 2030, 5, 2},
- {"csIBM273", 2030, 8, 1},
- {"IBM274", 2031, 6, 4},
- {"EBCDIC-BE", 2031, 9, 3},
- {"CP274", 2031, 5, 2},
- {"csIBM274", 2031, 8, 1},
- {"IBM275", 2032, 6, 4},
- {"EBCDIC-BR", 2032, 9, 3},
- {"cp275", 2032, 5, 2},
- {"csIBM275", 2032, 8, 1},
- {"IBM277", 2033, 6, 4},
- {"EBCDIC-CP-DK", 2033, 12, 3},
- {"EBCDIC-CP-NO", 2033, 12, 2},
- {"csIBM277", 2033, 8, 1},
- {"IBM278", 2034, 6, 5},
- {"CP278", 2034, 5, 4},
- {"ebcdic-cp-fi", 2034, 12, 3},
- {"ebcdic-cp-se", 2034, 12, 2},
- {"csIBM278", 2034, 8, 1},
- {"IBM280", 2035, 6, 4},
- {"CP280", 2035, 5, 3},
- {"ebcdic-cp-it", 2035, 12, 2},
- {"csIBM280", 2035, 8, 1},
- {"IBM281", 2036, 6, 4},
- {"EBCDIC-JP-E", 2036, 11, 3},
- {"cp281", 2036, 5, 2},
- {"csIBM281", 2036, 8, 1},
- {"IBM284", 2037, 6, 4},
- {"CP284", 2037, 5, 3},
- {"ebcdic-cp-es", 2037, 12, 2},
- {"csIBM284", 2037, 8, 1},
- {"IBM285", 2038, 6, 4},
- {"CP285", 2038, 5, 3},
- {"ebcdic-cp-gb", 2038, 12, 2},
- {"csIBM285", 2038, 8, 1},
- {"IBM290", 2039, 6, 4},
- {"cp290", 2039, 5, 3},
- {"EBCDIC-JP-kana", 2039, 14, 2},
- {"csIBM290", 2039, 8, 1},
- {"IBM297", 2040, 6, 4},
- {"cp297", 2040, 5, 3},
- {"ebcdic-cp-fr", 2040, 12, 2},
- {"csIBM297", 2040, 8, 1},
- {"IBM420", 2041, 6, 4},
- {"cp420", 2041, 5, 3},
- {"ebcdic-cp-ar1", 2041, 13, 2},
- {"csIBM420", 2041, 8, 1},
- {"IBM423", 2042, 6, 4},
- {"cp423", 2042, 5, 3},
- {"ebcdic-cp-gr", 2042, 12, 2},
- {"csIBM423", 2042, 8, 1},
- {"IBM424", 2043, 6, 4},
- {"cp424", 2043, 5, 3},
- {"ebcdic-cp-he", 2043, 12, 2},
- {"csIBM424", 2043, 8, 1},
- {"IBM500", 2044, 6, 5},
- {"CP500", 2044, 5, 4},
- {"ebcdic-cp-be", 2044, 12, 3},
- {"ebcdic-cp-ch", 2044, 12, 2},
- {"csIBM500", 2044, 8, 1},
- {"IBM851", 2045, 6, 4},
- {"cp851", 2045, 5, 3},
- {"851", 2045, 3, 2},
- {"csIBM851", 2045, 8, 1},
- {"IBM855", 2046, 6, 4},
- {"cp855", 2046, 5, 3},
- {"855", 2046, 3, 2},
- {"csIBM855", 2046, 8, 1},
- {"IBM857", 2047, 6, 4},
- {"cp857", 2047, 5, 3},
- {"857", 2047, 3, 2},
- {"csIBM857", 2047, 8, 1},
- {"IBM860", 2048, 6, 4},
- {"cp860", 2048, 5, 3},
- {"860", 2048, 3, 2},
- {"csIBM860", 2048, 8, 1},
- {"IBM861", 2049, 6, 5},
- {"cp861", 2049, 5, 4},
- {"861", 2049, 3, 3},
- {"cp-is", 2049, 5, 2},
- {"csIBM861", 2049, 8, 1},
- {"IBM863", 2050, 6, 4},
- {"cp863", 2050, 5, 3},
- {"863", 2050, 3, 2},
- {"csIBM863", 2050, 8, 1},
- {"IBM864", 2051, 6, 3},
- {"cp864", 2051, 5, 2},
- {"csIBM864", 2051, 8, 1},
- {"IBM865", 2052, 6, 4},
- {"cp865", 2052, 5, 3},
- {"865", 2052, 3, 2},
- {"csIBM865", 2052, 8, 1},
- {"IBM868", 2053, 6, 4},
- {"CP868", 2053, 5, 3},
- {"cp-ar", 2053, 5, 2},
- {"csIBM868", 2053, 8, 1},
- {"IBM869", 2054, 6, 5},
- {"cp869", 2054, 5, 4},
- {"869", 2054, 3, 3},
- {"cp-gr", 2054, 5, 2},
- {"csIBM869", 2054, 8, 1},
- {"IBM870", 2055, 6, 5},
- {"CP870", 2055, 5, 4},
- {"ebcdic-cp-roece", 2055, 15, 3},
- {"ebcdic-cp-yu", 2055, 12, 2},
- {"csIBM870", 2055, 8, 1},
- {"IBM871", 2056, 6, 4},
- {"CP871", 2056, 5, 3},
- {"ebcdic-cp-is", 2056, 12, 2},
- {"csIBM871", 2056, 8, 1},
- {"IBM880", 2057, 6, 4},
- {"cp880", 2057, 5, 3},
- {"EBCDIC-Cyrillic", 2057, 15, 2},
- {"csIBM880", 2057, 8, 1},
- {"IBM891", 2058, 6, 3},
- {"cp891", 2058, 5, 2},
- {"csIBM891", 2058, 8, 1},
- {"IBM903", 2059, 6, 3},
- {"cp903", 2059, 5, 2},
- {"csIBM903", 2059, 8, 1},
- {"IBM904", 2060, 6, 4},
- {"cp904", 2060, 5, 3},
- {"904", 2060, 3, 2},
- {"csIBBM904", 2060, 9, 1},
- {"IBM905", 2061, 6, 4},
- {"CP905", 2061, 5, 3},
- {"ebcdic-cp-tr", 2061, 12, 2},
- {"csIBM905", 2061, 8, 1},
- {"IBM918", 2062, 6, 4},
- {"CP918", 2062, 5, 3},
- {"ebcdic-cp-ar2", 2062, 13, 2},
- {"csIBM918", 2062, 8, 1},
- {"IBM1026", 2063, 7, 3},
- {"CP1026", 2063, 6, 2},
- {"csIBM1026", 2063, 9, 1},
- {"EBCDIC-AT-DE", 2064, 12, 2},
- {"csIBMEBCDICATDE", 2064, 15, 1},
- {"EBCDIC-AT-DE-A", 2065, 14, 2},
- {"csEBCDICATDEA", 2065, 13, 1},
- {"EBCDIC-CA-FR", 2066, 12, 2},
- {"csEBCDICCAFR", 2066, 12, 1},
- {"EBCDIC-DK-NO", 2067, 12, 2},
- {"csEBCDICDKNO", 2067, 12, 1},
- {"EBCDIC-DK-NO-A", 2068, 14, 2},
- {"csEBCDICDKNOA", 2068, 13, 1},
- {"EBCDIC-FI-SE", 2069, 12, 2},
- {"csEBCDICFISE", 2069, 12, 1},
- {"EBCDIC-FI-SE-A", 2070, 14, 2},
- {"csEBCDICFISEA", 2070, 13, 1},
- {"EBCDIC-FR", 2071, 9, 2},
- {"csEBCDICFR", 2071, 10, 1},
- {"EBCDIC-IT", 2072, 9, 2},
- {"csEBCDICIT", 2072, 10, 1},
- {"EBCDIC-PT", 2073, 9, 2},
- {"csEBCDICPT", 2073, 10, 1},
- {"EBCDIC-ES", 2074, 9, 2},
- {"csEBCDICES", 2074, 10, 1},
- {"EBCDIC-ES-A", 2075, 11, 2},
- {"csEBCDICESA", 2075, 11, 1},
- {"EBCDIC-ES-S", 2076, 11, 2},
- {"csEBCDICESS", 2076, 11, 1},
- {"EBCDIC-UK", 2077, 9, 2},
- {"csEBCDICUK", 2077, 10, 1},
- {"EBCDIC-US", 2078, 9, 2},
- {"csEBCDICUS", 2078, 10, 1},
- {"UNKNOWN-8BIT", 2079, 12, 2},
- {"csUnknown8BiT", 2079, 13, 1},
- {"MNEMONIC", 2080, 8, 2},
- {"csMnemonic", 2080, 10, 1},
- {"MNEM", 2081, 4, 2},
- {"csMnem", 2081, 6, 1},
- {"VISCII", 2082, 6, 2},
- {"csVISCII", 2082, 8, 1},
- {"VIQR", 2083, 4, 2},
- {"csVIQR", 2083, 6, 1},
- {"KOI8-R", 2084, 6, 2},
- {"csKOI8R", 2084, 7, 1},
- {"HZ-GB-2312", 2085, 10, 1},
- {"IBM866", 2086, 6, 4},
- {"cp866", 2086, 5, 3},
- {"866", 2086, 3, 2},
- {"csIBM866", 2086, 8, 1},
- {"IBM775", 2087, 6, 3},
- {"cp775", 2087, 5, 2},
- {"csPC775Baltic", 2087, 13, 1},
- {"KOI8-U", 2088, 6, 2},
- {"csKOI8U", 2088, 7, 1},
- {"IBM00858", 2089, 8, 5},
- {"CCSID00858", 2089, 10, 4},
- {"CP00858", 2089, 7, 3},
- {"PC-Multilingual-850+euro", 2089, 24, 2},
- {"csIBM00858", 2089, 10, 1},
- {"IBM00924", 2090, 8, 5},
- {"CCSID00924", 2090, 10, 4},
- {"CP00924", 2090, 7, 3},
- {"ebcdic-Latin9--euro", 2090, 19, 2},
- {"csIBM00924", 2090, 10, 1},
- {"IBM01140", 2091, 8, 5},
- {"CCSID01140", 2091, 10, 4},
- {"CP01140", 2091, 7, 3},
- {"ebcdic-us-37+euro", 2091, 17, 2},
- {"csIBM01140", 2091, 10, 1},
- {"IBM01141", 2092, 8, 5},
- {"CCSID01141", 2092, 10, 4},
- {"CP01141", 2092, 7, 3},
- {"ebcdic-de-273+euro", 2092, 18, 2},
- {"csIBM01141", 2092, 10, 1},
- {"IBM01142", 2093, 8, 6},
- {"CCSID01142", 2093, 10, 5},
- {"CP01142", 2093, 7, 4},
- {"ebcdic-dk-277+euro", 2093, 18, 3},
- {"ebcdic-no-277+euro", 2093, 18, 2},
- {"csIBM01142", 2093, 10, 1},
- {"IBM01143", 2094, 8, 6},
- {"CCSID01143", 2094, 10, 5},
- {"CP01143", 2094, 7, 4},
- {"ebcdic-fi-278+euro", 2094, 18, 3},
- {"ebcdic-se-278+euro", 2094, 18, 2},
- {"csIBM01143", 2094, 10, 1},
- {"IBM01144", 2095, 8, 5},
- {"CCSID01144", 2095, 10, 4},
- {"CP01144", 2095, 7, 3},
- {"ebcdic-it-280+euro", 2095, 18, 2},
- {"csIBM01144", 2095, 10, 1},
- {"IBM01145", 2096, 8, 5},
- {"CCSID01145", 2096, 10, 4},
- {"CP01145", 2096, 7, 3},
- {"ebcdic-es-284+euro", 2096, 18, 2},
- {"csIBM01145", 2096, 10, 1},
- {"IBM01146", 2097, 8, 5},
- {"CCSID01146", 2097, 10, 4},
- {"CP01146", 2097, 7, 3},
- {"ebcdic-gb-285+euro", 2097, 18, 2},
- {"csIBM01146", 2097, 10, 1},
- {"IBM01147", 2098, 8, 5},
- {"CCSID01147", 2098, 10, 4},
- {"CP01147", 2098, 7, 3},
- {"ebcdic-fr-297+euro", 2098, 18, 2},
- {"csIBM01147", 2098, 10, 1},
- {"IBM01148", 2099, 8, 5},
- {"CCSID01148", 2099, 10, 4},
- {"CP01148", 2099, 7, 3},
- {"ebcdic-international-500+euro", 2099, 29, 2},
- {"csIBM01148", 2099, 10, 1},
- {"IBM01149", 2100, 8, 5},
- {"CCSID01149", 2100, 10, 4},
- {"CP01149", 2100, 7, 3},
- {"ebcdic-is-871+euro", 2100, 18, 2},
- {"csIBM01149", 2100, 10, 1},
- {"Big5-HKSCS", 2101, 10, 2},
- {"csBig5HKSCS", 2101, 11, 1},
- {"IBM1047", 2102, 7, 3},
- {"IBM-1047", 2102, 8, 2},
- {"csIBM1047", 2102, 9, 1},
- {"PTCP154", 2103, 7, 5},
- {"csPTCP154", 2103, 9, 4},
- {"PT154", 2103, 5, 3},
- {"CP154", 2103, 5, 2},
- {"Cyrillic-Asian", 2103, 14, 1},
- {"Amiga-1251", 2104, 10, 5},
- {"Ami1251", 2104, 7, 4},
- {"Amiga1251", 2104, 9, 3},
- {"Ami-1251", 2104, 8, 2},
- {"csAmiga1251", 2104, 11, 1},
- {"KOI7-switched", 2105, 13, 2},
- {"csKOI7switched", 2105, 14, 1},
- {"BRF", 2106, 3, 2},
- {"csBRF", 2106, 5, 1},
- {"TSCII", 2107, 5, 2},
- {"csTSCII", 2107, 7, 1},
- {"CP51932", 2108, 7, 2},
- {"csCP51932", 2108, 9, 1},
- {"windows-874", 2109, 11, 2},
- {"cswindows874", 2109, 12, 1},
- {"windows-1250", 2250, 12, 2},
- {"cswindows1250", 2250, 13, 1},
- {"windows-1251", 2251, 12, 2},
- {"cswindows1251", 2251, 13, 1},
- {"windows-1252", 2252, 12, 2},
- {"cswindows1252", 2252, 13, 1},
- {"windows-1253", 2253, 12, 2},
- {"cswindows1253", 2253, 13, 1},
- {"windows-1254", 2254, 12, 2},
- {"cswindows1254", 2254, 13, 1},
- {"windows-1255", 2255, 12, 2},
- {"cswindows1255", 2255, 13, 1},
- {"windows-1256", 2256, 12, 2},
- {"cswindows1256", 2256, 13, 1},
- {"windows-1257", 2257, 12, 2},
- {"cswindows1257", 2257, 13, 1},
- {"windows-1258", 2258, 12, 2},
- {"cswindows1258", 2258, 13, 1},
- {"TIS-620", 2259, 7, 3},
- {"csTIS620", 2259, 8, 2},
- {"ISO-8859-11", 2259, 11, 1},
- {"CP50220", 2260, 7, 2},
- {"csCP50220", 2260, 9, 1}};
+ // Structuring the text encoding data and the table in this manner has a few benefits:
+ // Smaller footprint: We only need 6 bytes for the information we need.
+ // Smaller total table: We only need one entry per Mib.
+ // Easier aliases_view: We know the begin, and end of each range of aliases, which makes iterator
+ // implementation simple.
+
+ static constexpr __te_data __entries[] = {
+ {0, 1, 0}, {1, 2, 0}, {2, 3, 11}, {13, 4, 9}, {22, 5, 7}, {29, 6, 7}, {36, 7, 7},
+ {43, 8, 6}, {49, 9, 8}, {57, 10, 9}, {66, 11, 6}, {72, 12, 7}, {79, 13, 6}, {85, 14, 3},
+ {88, 15, 3}, {91, 16, 2}, {93, 17, 3}, {96, 18, 3}, {99, 19, 2}, {101, 20, 6}, {107, 21, 5},
+ {112, 22, 4}, {116, 23, 4}, {120, 24, 5}, {125, 25, 6}, {131, 26, 5}, {136, 27, 2}, {138, 28, 3},
+ {141, 29, 2}, {143, 30, 4}, {147, 31, 3}, {150, 32, 3}, {153, 35, 7}, {160, 36, 6}, {166, 37, 2},
+ {168, 38, 2}, {170, 39, 2}, {172, 40, 2}, {174, 41, 6}, {180, 42, 5}, {185, 43, 4}, {189, 44, 3},
+ {192, 45, 3}, {195, 46, 4}, {199, 47, 3}, {202, 48, 3}, {205, 49, 3}, {208, 50, 3}, {211, 51, 3},
+ {214, 52, 3}, {217, 53, 3}, {220, 54, 4}, {224, 55, 3}, {227, 56, 5}, {232, 57, 4}, {236, 58, 5},
+ {241, 59, 3}, {244, 60, 4}, {248, 61, 4}, {252, 62, 5}, {257, 63, 5}, {262, 64, 3}, {265, 65, 5},
+ {270, 66, 2}, {272, 67, 4}, {276, 68, 5}, {281, 69, 4}, {285, 70, 4}, {289, 71, 4}, {293, 72, 3},
+ {296, 73, 4}, {300, 74, 5}, {305, 75, 3}, {308, 76, 4}, {312, 77, 4}, {316, 78, 7}, {323, 79, 6},
+ {329, 80, 3}, {332, 81, 3}, {335, 82, 3}, {338, 83, 3}, {341, 84, 3}, {344, 85, 3}, {347, 86, 3},
+ {350, 87, 6}, {356, 88, 3}, {359, 89, 4}, {363, 90, 4}, {367, 91, 4}, {371, 92, 5}, {376, 93, 3},
+ {379, 94, 4}, {383, 95, 4}, {387, 96, 3}, {390, 97, 4}, {394, 98, 4}, {398, 99, 5}, {403, 100, 2},
+ {405, 101, 2}, {407, 102, 3}, {410, 103, 2}, {412, 104, 2}, {414, 105, 2}, {416, 106, 2}, {418, 109, 2},
+ {420, 110, 8}, {428, 111, 4}, {432, 112, 7}, {439, 113, 5}, {444, 114, 2}, {446, 115, 2}, {448, 116, 2},
+ {450, 117, 2}, {452, 118, 4}, {456, 119, 4}, {460, 1000, 2}, {462, 1001, 2}, {464, 1002, 2}, {466, 1003, 3},
+ {469, 1004, 2}, {471, 1005, 2}, {473, 1006, 2}, {475, 1007, 2}, {477, 1008, 2}, {479, 1009, 2}, {481, 1010, 2},
+ {483, 1011, 2}, {485, 1012, 2}, {487, 1013, 2}, {489, 1014, 2}, {491, 1015, 2}, {493, 1016, 3}, {496, 1017, 2},
+ {498, 1018, 2}, {500, 1019, 2}, {502, 1020, 3}, {505, 1021, 2}, {507, 2000, 2}, {509, 2001, 2}, {511, 2002, 2},
+ {513, 2003, 2}, {515, 2004, 4}, {519, 2005, 2}, {521, 2006, 2}, {523, 2007, 2}, {525, 2008, 3}, {528, 2009, 4},
+ {532, 2010, 4}, {536, 2011, 4}, {540, 2012, 2}, {542, 2013, 4}, {546, 2014, 2}, {548, 2015, 2}, {550, 2016, 2},
+ {552, 2017, 2}, {554, 2018, 2}, {556, 2019, 2}, {558, 2020, 2}, {560, 2021, 2}, {562, 2022, 2}, {564, 2023, 2},
+ {566, 2024, 2}, {568, 2025, 2}, {570, 2026, 2}, {572, 2027, 3}, {575, 2028, 7}, {582, 2029, 4}, {586, 2030, 3},
+ {589, 2031, 4}, {593, 2032, 4}, {597, 2033, 4}, {601, 2034, 5}, {606, 2035, 4}, {610, 2036, 4}, {614, 2037, 4},
+ {618, 2038, 4}, {622, 2039, 4}, {626, 2040, 4}, {630, 2041, 4}, {634, 2042, 4}, {638, 2043, 4}, {642, 2044, 5},
+ {647, 2045, 4}, {651, 2046, 4}, {655, 2047, 4}, {659, 2048, 4}, {663, 2049, 5}, {668, 2050, 4}, {672, 2051, 3},
+ {675, 2052, 4}, {679, 2053, 4}, {683, 2054, 5}, {688, 2055, 5}, {693, 2056, 4}, {697, 2057, 4}, {701, 2058, 3},
+ {704, 2059, 3}, {707, 2060, 4}, {711, 2061, 4}, {715, 2062, 4}, {719, 2063, 3}, {722, 2064, 2}, {724, 2065, 2},
+ {726, 2066, 2}, {728, 2067, 2}, {730, 2068, 2}, {732, 2069, 2}, {734, 2070, 2}, {736, 2071, 2}, {738, 2072, 2},
+ {740, 2073, 2}, {742, 2074, 2}, {744, 2075, 2}, {746, 2076, 2}, {748, 2077, 2}, {750, 2078, 2}, {752, 2079, 2},
+ {754, 2080, 2}, {756, 2081, 2}, {758, 2082, 2}, {760, 2083, 2}, {762, 2084, 2}, {764, 2085, 1}, {765, 2086, 4},
+ {769, 2087, 3}, {772, 2088, 2}, {774, 2089, 5}, {779, 2090, 5}, {784, 2091, 5}, {789, 2092, 5}, {794, 2093, 6},
+ {800, 2094, 6}, {806, 2095, 5}, {811, 2096, 5}, {816, 2097, 5}, {821, 2098, 5}, {826, 2099, 5}, {831, 2100, 5},
+ {836, 2101, 2}, {838, 2102, 3}, {841, 2103, 5}, {846, 2104, 5}, {851, 2105, 2}, {853, 2106, 2}, {855, 2107, 2},
+ {857, 2108, 2}, {859, 2109, 2}, {861, 2250, 2}, {863, 2251, 2}, {865, 2252, 2}, {867, 2253, 2}, {869, 2254, 2},
+ {871, 2255, 2}, {873, 2256, 2}, {875, 2257, 2}, {877, 2258, 2}, {879, 2259, 3}, {882, 2260, 2}};
+
+ static constexpr char const* __aliases_table[] = {
+ "",
+ "",
+ "US-ASCII",
+ "iso-ir-6",
+ "ANSI_X3.4-1968",
+ "ANSI_X3.4-1986",
+ "ISO_646.irv:1991",
+ "ISO646-US",
+ "us",
+ "IBM367",
+ "cp367",
+ "csASCII",
+ "ASCII",
+ "ISO_8859-1:1987",
+ "iso-ir-100",
+ "ISO_8859-1",
+ "ISO-8859-1",
+ "latin1",
+ "l1",
+ "IBM819",
+ "CP819",
+ "csISOLatin1",
+ "ISO_8859-2:1987",
+ "iso-ir-101",
+ "ISO_8859-2",
+ "ISO-8859-2",
+ "latin2",
+ "l2",
+ "csISOLatin2",
+ "ISO_8859-3:1988",
+ "iso-ir-109",
+ "ISO_8859-3",
+ "ISO-8859-3",
+ "latin3",
+ "l3",
+ "csISOLatin3",
+ "ISO_8859-4:1988",
+ "iso-ir-110",
+ "ISO_8859-4",
+ "ISO-8859-4",
+ "latin4",
+ "l4",
+ "csISOLatin4",
+ "ISO_8859-5:1988",
+ "iso-ir-144",
+ "ISO_8859-5",
+ "ISO-8859-5",
+ "cyrillic",
+ "csISOLatinCyrillic",
+ "ISO_8859-6:1987",
+ "iso-ir-127",
+ "ISO_8859-6",
+ "ISO-8859-6",
+ "ECMA-114",
+ "ASMO-708",
+ "arabic",
+ "csISOLatinArabic",
+ "ISO_8859-7:1987",
+ "iso-ir-126",
+ "ISO_8859-7",
+ "ISO-8859-7",
+ "ELOT_928",
+ "ECMA-118",
+ "greek",
+ "greek8",
+ "csISOLatinGreek",
+ "ISO_8859-8:1988",
+ "iso-ir-138",
+ "ISO_8859-8",
+ "ISO-8859-8",
+ "hebrew",
+ "csISOLatinHebrew",
+ "ISO_8859-9:1989",
+ "iso-ir-148",
+ "ISO_8859-9",
+ "ISO-8859-9",
+ "latin5",
+ "l5",
+ "csISOLatin5",
+ "ISO-8859-10",
+ "iso-ir-157",
+ "l6",
+ "ISO_8859-10:1992",
+ "csISOLatin6",
+ "latin6",
+ "ISO_6937-2-add",
+ "iso-ir-142",
+ "csISOTextComm",
+ "JIS_X0201",
+ "X0201",
+ "csHalfWidthKatakana",
+ "JIS_Encoding",
+ "csJISEncoding",
+ "Shift_JIS",
+ "MS_Kanji",
+ "csShiftJIS",
+ "Extended_UNIX_Code_Packed_Format_for_Japanese",
+ "csEUCPkdFmtJapanese",
+ "EUC-JP",
+ "Extended_UNIX_Code_Fixed_Width_for_Japanese",
+ "csEUCFixWidJapanese",
+ "BS_4730",
+ "iso-ir-4",
+ "ISO646-GB",
+ "gb",
+ "uk",
+ "csISO4UnitedKingdom",
+ "SEN_850200_C",
+ "iso-ir-11",
+ "ISO646-SE2",
+ "se2",
+ "csISO11SwedishForNames",
+ "IT",
+ "iso-ir-15",
+ "ISO646-IT",
+ "csISO15Italian",
+ "ES",
+ "iso-ir-17",
+ "ISO646-ES",
+ "csISO17Spanish",
+ "DIN_66003",
+ "iso-ir-21",
+ "de",
+ "ISO646-DE",
+ "csISO21German",
+ "NS_4551-1",
+ "iso-ir-60",
+ "ISO646-NO",
+ "no",
+ "csISO60DanishNorwegian",
+ "csISO60Norwegian1",
+ "NF_Z_62-010",
+ "iso-ir-69",
+ "ISO646-FR",
+ "fr",
+ "csISO69French",
+ "ISO-10646-UTF-1",
+ "csISO10646UTF1",
+ "ISO_646.basic:1983",
+ "ref",
+ "csISO646basic1983",
+ "INVARIANT",
+ "csINVARIANT",
+ "ISO_646.irv:1983",
+ "iso-ir-2",
+ "irv",
+ "csISO2IntlRefVersion",
+ "NATS-SEFI",
+ "iso-ir-8-1",
+ "csNATSSEFI",
+ "NATS-SEFI-ADD",
+ "iso-ir-8-2",
+ "csNATSSEFIADD",
+ "SEN_850200_B",
+ "iso-ir-10",
+ "FI",
+ "ISO646-FI",
+ "ISO646-SE",
+ "se",
+ "csISO10Swedish",
+ "KS_C_5601-1987",
+ "iso-ir-149",
+ "KS_C_5601-1989",
+ "KSC_5601",
+ "korean",
+ "csKSC56011987",
+ "ISO-2022-KR",
+ "csISO2022KR",
+ "EUC-KR",
+ "csEUCKR",
+ "ISO-2022-JP",
+ "csISO2022JP",
+ "ISO-2022-JP-2",
+ "csISO2022JP2",
+ "JIS_C6220-1969-jp",
+ "JIS_C6220-1969",
+ "iso-ir-13",
+ "katakana",
+ "x0201-7",
+ "csISO13JISC6220jp",
+ "JIS_C6220-1969-ro",
+ "iso-ir-14",
+ "jp",
+ "ISO646-JP",
+ "csISO14JISC6220ro",
+ "PT",
+ "iso-ir-16",
+ "ISO646-PT",
+ "csISO16Portuguese",
+ "greek7-old",
+ "iso-ir-18",
+ "csISO18Greek7Old",
+ "latin-greek",
+ "iso-ir-19",
+ "csISO19LatinGreek",
+ "NF_Z_62-010_(1973)",
+ "iso-ir-25",
+ "ISO646-FR1",
+ "csISO25French",
+ "Latin-greek-1",
+ "iso-ir-27",
+ "csISO27LatinGreek1",
+ "ISO_5427",
+ "iso-ir-37",
+ "csISO5427Cyrillic",
+ "JIS_C6226-1978",
+ "iso-ir-42",
+ "csISO42JISC62261978",
+ "BS_viewdata",
+ "iso-ir-47",
+ "csISO47BSViewdata",
+ "INIS",
+ "iso-ir-49",
+ "csISO49INIS",
+ "INIS-8",
+ "iso-ir-50",
+ "csISO50INIS8",
+ "INIS-cyrillic",
+ "iso-ir-51",
+ "csISO51INISCyrillic",
+ "ISO_5427:1981",
+ "iso-ir-54",
+ "ISO5427Cyrillic1981",
+ "csISO54271981",
+ "ISO_5428:1980",
+ "iso-ir-55",
+ "csISO5428Greek",
+ "GB_1988-80",
+ "iso-ir-57",
+ "cn",
+ "ISO646-CN",
+ "csISO57GB1988",
+ "GB_2312-80",
+ "iso-ir-58",
+ "chinese",
+ "csISO58GB231280",
+ "NS_4551-2",
+ "ISO646-NO2",
+ "iso-ir-61",
+ "no2",
+ "csISO61Norwegian2",
+ "videotex-suppl",
+ "iso-ir-70",
+ "csISO70VideotexSupp1",
+ "PT2",
+ "iso-ir-84",
+ "ISO646-PT2",
+ "csISO84Portuguese2",
+ "ES2",
+ "iso-ir-85",
+ "ISO646-ES2",
+ "csISO85Spanish2",
+ "MSZ_7795.3",
+ "iso-ir-86",
+ "ISO646-HU",
+ "hu",
+ "csISO86Hungarian",
+ "JIS_C6226-1983",
+ "iso-ir-87",
+ "x0208",
+ "JIS_X0208-1983",
+ "csISO87JISX0208",
+ "greek7",
+ "iso-ir-88",
+ "csISO88Greek7",
+ "ASMO_449",
+ "ISO_9036",
+ "arabic7",
+ "iso-ir-89",
+ "csISO89ASMO449",
+ "iso-ir-90",
+ "csISO90",
+ "JIS_C6229-1984-a",
+ "iso-ir-91",
+ "jp-ocr-a",
+ "csISO91JISC62291984a",
+ "JIS_C6229-1984-b",
+ "iso-ir-92",
+ "ISO646-JP-OCR-B",
+ "jp-ocr-b",
+ "csISO92JISC62991984b",
+ "JIS_C6229-1984-b-add",
+ "iso-ir-93",
+ "jp-ocr-b-add",
+ "csISO93JIS62291984badd",
+ "JIS_C6229-1984-hand",
+ "iso-ir-94",
+ "jp-ocr-hand",
+ "csISO94JIS62291984hand",
+ "JIS_C6229-1984-hand-add",
+ "iso-ir-95",
+ "jp-ocr-hand-add",
+ "csISO95JIS62291984handadd",
+ "JIS_C6229-1984-kana",
+ "iso-ir-96",
+ "csISO96JISC62291984kana",
+ "ISO_2033-1983",
+ "iso-ir-98",
+ "e13b",
+ "csISO2033",
+ "ANSI_X3.110-1983",
+ "iso-ir-99",
+ "CSA_T500-1983",
+ "NAPLPS",
+ "csISO99NAPLPS",
+ "T.61-7bit",
+ "iso-ir-102",
+ "csISO102T617bit",
+ "T.61-8bit",
+ "T.61",
+ "iso-ir-103",
+ "csISO103T618bit",
+ "ECMA-cyrillic",
+ "iso-ir-111",
+ "KOI8-E",
+ "csISO111ECMACyrillic",
+ "CSA_Z243.4-1985-1",
+ "iso-ir-121",
+ "ISO646-CA",
+ "csa7-1",
+ "csa71",
+ "ca",
+ "csISO121Canadian1",
+ "CSA_Z243.4-1985-2",
+ "iso-ir-122",
+ "ISO646-CA2",
+ "csa7-2",
+ "csa72",
+ "csISO122Canadian2",
+ "CSA_Z243.4-1985-gr",
+ "iso-ir-123",
+ "csISO123CSAZ24341985gr",
+ "ISO_8859-6-E",
+ "csISO88596E",
+ "ISO-8859-6-E",
+ "ISO_8859-6-I",
+ "csISO88596I",
+ "ISO-8859-6-I",
+ "T.101-G2",
+ "iso-ir-128",
+ "csISO128T101G2",
+ "ISO_8859-8-E",
+ "csISO88598E",
+ "ISO-8859-8-E",
+ "ISO_8859-8-I",
+ "csISO88598I",
+ "ISO-8859-8-I",
+ "CSN_369103",
+ "iso-ir-139",
+ "csISO139CSN369103",
+ "JUS_I.B1.002",
+ "iso-ir-141",
+ "ISO646-YU",
+ "js",
+ "yu",
+ "csISO141JUSIB1002",
+ "IEC_P27-1",
+ "iso-ir-143",
+ "csISO143IECP271",
+ "JUS_I.B1.003-serb",
+ "iso-ir-146",
+ "serbian",
+ "csISO146Serbian",
+ "JUS_I.B1.003-mac",
+ "macedonian",
+ "iso-ir-147",
+ "csISO147Macedonian",
+ "greek-ccitt",
+ "iso-ir-150",
+ "csISO150",
+ "csISO150GreekCCITT",
+ "NC_NC00-10:81",
+ "cuba",
+ "iso-ir-151",
+ "ISO646-CU",
+ "csISO151Cuba",
+ "ISO_6937-2-25",
+ "iso-ir-152",
+ "csISO6937Add",
+ "GOST_19768-74",
+ "ST_SEV_358-88",
+ "iso-ir-153",
+ "csISO153GOST1976874",
+ "ISO_8859-supp",
+ "iso-ir-154",
+ "latin1-2-5",
+ "csISO8859Supp",
+ "ISO_10367-box",
+ "iso-ir-155",
+ "csISO10367Box",
+ "latin-lap",
+ "lap",
+ "iso-ir-158",
+ "csISO158Lap",
+ "JIS_X0212-1990",
+ "x0212",
+ "iso-ir-159",
+ "csISO159JISX02121990",
+ "DS_2089",
+ "DS2089",
+ "ISO646-DK",
+ "dk",
+ "csISO646Danish",
+ "us-dk",
+ "csUSDK",
+ "dk-us",
+ "csDKUS",
+ "KSC5636",
+ "ISO646-KR",
+ "csKSC5636",
+ "UNICODE-1-1-UTF-7",
+ "csUnicode11UTF7",
+ "ISO-2022-CN",
+ "csISO2022CN",
+ "ISO-2022-CN-EXT",
+ "csISO2022CNEXT",
+ "UTF-8",
+ "csUTF8",
+ "ISO-8859-13",
+ "csISO885913",
+ "ISO-8859-14",
+ "iso-ir-199",
+ "ISO_8859-14:1998",
+ "ISO_8859-14",
+ "latin8",
+ "iso-celtic",
+ "l8",
+ "csISO885914",
+ "ISO-8859-15",
+ "ISO_8859-15",
+ "Latin-9",
+ "csISO885915",
+ "ISO-8859-16",
+ "iso-ir-226",
+ "ISO_8859-16:2001",
+ "ISO_8859-16",
+ "latin10",
+ "l10",
+ "csISO885916",
+ "GBK",
+ "CP936",
+ "MS936",
+ "windows-936",
+ "csGBK",
+ "GB18030",
+ "csGB18030",
+ "OSD_EBCDIC_DF04_15",
+ "csOSDEBCDICDF0415",
+ "OSD_EBCDIC_DF03_IRV",
+ "csOSDEBCDICDF03IRV",
+ "OSD_EBCDIC_DF04_1",
+ "csOSDEBCDICDF041",
+ "ISO-11548-1",
+ "ISO_11548-1",
+ "ISO_TR_11548-1",
+ "csISO115481",
+ "KZ-1048",
+ "STRK1048-2002",
+ "RK1048",
+ "csKZ1048",
+ "ISO-10646-UCS-2",
+ "csUnicode",
+ "ISO-10646-UCS-4",
+ "csUCS4",
+ "ISO-10646-UCS-Basic",
+ "csUnicodeASCII",
+ "ISO-10646-Unicode-Latin1",
+ "csUnicodeLatin1",
+ "ISO-10646",
+ "ISO-10646-J-1",
+ "csUnicodeJapanese",
+ "ISO-Unicode-IBM-1261",
+ "csUnicodeIBM1261",
+ "ISO-Unicode-IBM-1268",
+ "csUnicodeIBM1268",
+ "ISO-Unicode-IBM-1276",
+ "csUnicodeIBM1276",
+ "ISO-Unicode-IBM-1264",
+ "csUnicodeIBM1264",
+ "ISO-Unicode-IBM-1265",
+ "csUnicodeIBM1265",
+ "UNICODE-1-1",
+ "csUnicode11",
+ "SCSU",
+ "csSCSU",
+ "UTF-7",
+ "csUTF7",
+ "UTF-16BE",
+ "csUTF16BE",
+ "UTF-16LE",
+ "csUTF16LE",
+ "UTF-16",
+ "csUTF16",
+ "CESU-8",
+ "csCESU8",
+ "csCESU-8",
+ "UTF-32",
+ "csUTF32",
+ "UTF-32BE",
+ "csUTF32BE",
+ "UTF-32LE",
+ "csUTF32LE",
+ "BOCU-1",
+ "csBOCU1",
+ "csBOCU-1",
+ "UTF-7-IMAP",
+ "csUTF7IMAP",
+ "ISO-8859-1-Windows-3.0-Latin-1",
+ "csWindows30Latin1",
+ "ISO-8859-1-Windows-3.1-Latin-1",
+ "csWindows31Latin1",
+ "ISO-8859-2-Windows-Latin-2",
+ "csWindows31Latin2",
+ "ISO-8859-9-Windows-Latin-5",
+ "csWindows31Latin5",
+ "hp-roman8",
+ "roman8",
+ "r8",
+ "csHPRoman8",
+ "Adobe-Standard-Encoding",
+ "csAdobeStandardEncoding",
+ "Ventura-US",
+ "csVenturaUS",
+ "Ventura-International",
+ "csVenturaInternational",
+ "DEC-MCS",
+ "dec",
+ "csDECMCS",
+ "IBM850",
+ "cp850",
+ "850",
+ "csPC850Multilingual",
+ "IBM852",
+ "cp852",
+ "852",
+ "csPCp852",
+ "IBM437",
+ "cp437",
+ "437",
+ "csPC8CodePage437",
+ "PC8-Danish-Norwegian",
+ "csPC8DanishNorwegian",
+ "IBM862",
+ "cp862",
+ "862",
+ "csPC862LatinHebrew",
+ "PC8-Turkish",
+ "csPC8Turkish",
+ "IBM-Symbols",
+ "csIBMSymbols",
+ "IBM-Thai",
+ "csIBMThai",
+ "HP-Legal",
+ "csHPLegal",
+ "HP-Pi-font",
+ "csHPPiFont",
+ "HP-Math8",
+ "csHPMath8",
+ "Adobe-Symbol-Encoding",
+ "csHPPSMath",
+ "HP-DeskTop",
+ "csHPDesktop",
+ "Ventura-Math",
+ "csVenturaMath",
+ "Microsoft-Publishing",
+ "csMicrosoftPublishing",
+ "Windows-31J",
+ "csWindows31J",
+ "GB2312",
+ "csGB2312",
+ "Big5",
+ "csBig5",
+ "macintosh",
+ "mac",
+ "csMacintosh",
+ "IBM037",
+ "cp037",
+ "ebcdic-cp-us",
+ "ebcdic-cp-ca",
+ "ebcdic-cp-wt",
+ "ebcdic-cp-nl",
+ "csIBM037",
+ "IBM038",
+ "EBCDIC-INT",
+ "cp038",
+ "csIBM038",
+ "IBM273",
+ "CP273",
+ "csIBM273",
+ "IBM274",
+ "EBCDIC-BE",
+ "CP274",
+ "csIBM274",
+ "IBM275",
+ "EBCDIC-BR",
+ "cp275",
+ "csIBM275",
+ "IBM277",
+ "EBCDIC-CP-DK",
+ "EBCDIC-CP-NO",
+ "csIBM277",
+ "IBM278",
+ "CP278",
+ "ebcdic-cp-fi",
+ "ebcdic-cp-se",
+ "csIBM278",
+ "IBM280",
+ "CP280",
+ "ebcdic-cp-it",
+ "csIBM280",
+ "IBM281",
+ "EBCDIC-JP-E",
+ "cp281",
+ "csIBM281",
+ "IBM284",
+ "CP284",
+ "ebcdic-cp-es",
+ "csIBM284",
+ "IBM285",
+ "CP285",
+ "ebcdic-cp-gb",
+ "csIBM285",
+ "IBM290",
+ "cp290",
+ "EBCDIC-JP-kana",
+ "csIBM290",
+ "IBM297",
+ "cp297",
+ "ebcdic-cp-fr",
+ "csIBM297",
+ "IBM420",
+ "cp420",
+ "ebcdic-cp-ar1",
+ "csIBM420",
+ "IBM423",
+ "cp423",
+ "ebcdic-cp-gr",
+ "csIBM423",
+ "IBM424",
+ "cp424",
+ "ebcdic-cp-he",
+ "csIBM424",
+ "IBM500",
+ "CP500",
+ "ebcdic-cp-be",
+ "ebcdic-cp-ch",
+ "csIBM500",
+ "IBM851",
+ "cp851",
+ "851",
+ "csIBM851",
+ "IBM855",
+ "cp855",
+ "855",
+ "csIBM855",
+ "IBM857",
+ "cp857",
+ "857",
+ "csIBM857",
+ "IBM860",
+ "cp860",
+ "860",
+ "csIBM860",
+ "IBM861",
+ "cp861",
+ "861",
+ "cp-is",
+ "csIBM861",
+ "IBM863",
+ "cp863",
+ "863",
+ "csIBM863",
+ "IBM864",
+ "cp864",
+ "csIBM864",
+ "IBM865",
+ "cp865",
+ "865",
+ "csIBM865",
+ "IBM868",
+ "CP868",
+ "cp-ar",
+ "csIBM868",
+ "IBM869",
+ "cp869",
+ "869",
+ "cp-gr",
+ "csIBM869",
+ "IBM870",
+ "CP870",
+ "ebcdic-cp-roece",
+ "ebcdic-cp-yu",
+ "csIBM870",
+ "IBM871",
+ "CP871",
+ "ebcdic-cp-is",
+ "csIBM871",
+ "IBM880",
+ "cp880",
+ "EBCDIC-Cyrillic",
+ "csIBM880",
+ "IBM891",
+ "cp891",
+ "csIBM891",
+ "IBM903",
+ "cp903",
+ "csIBM903",
+ "IBM904",
+ "cp904",
+ "904",
+ "csIBBM904",
+ "IBM905",
+ "CP905",
+ "ebcdic-cp-tr",
+ "csIBM905",
+ "IBM918",
+ "CP918",
+ "ebcdic-cp-ar2",
+ "csIBM918",
+ "IBM1026",
+ "CP1026",
+ "csIBM1026",
+ "EBCDIC-AT-DE",
+ "csIBMEBCDICATDE",
+ "EBCDIC-AT-DE-A",
+ "csEBCDICATDEA",
+ "EBCDIC-CA-FR",
+ "csEBCDICCAFR",
+ "EBCDIC-DK-NO",
+ "csEBCDICDKNO",
+ "EBCDIC-DK-NO-A",
+ "csEBCDICDKNOA",
+ "EBCDIC-FI-SE",
+ "csEBCDICFISE",
+ "EBCDIC-FI-SE-A",
+ "csEBCDICFISEA",
+ "EBCDIC-FR",
+ "csEBCDICFR",
+ "EBCDIC-IT",
+ "csEBCDICIT",
+ "EBCDIC-PT",
+ "csEBCDICPT",
+ "EBCDIC-ES",
+ "csEBCDICES",
+ "EBCDIC-ES-A",
+ "csEBCDICESA",
+ "EBCDIC-ES-S",
+ "csEBCDICESS",
+ "EBCDIC-UK",
+ "csEBCDICUK",
+ "EBCDIC-US",
+ "csEBCDICUS",
+ "UNKNOWN-8BIT",
+ "csUnknown8BiT",
+ "MNEMONIC",
+ "csMnemonic",
+ "MNEM",
+ "csMnem",
+ "VISCII",
+ "csVISCII",
+ "VIQR",
+ "csVIQR",
+ "KOI8-R",
+ "csKOI8R",
+ "HZ-GB-2312",
+ "IBM866",
+ "cp866",
+ "866",
+ "csIBM866",
+ "IBM775",
+ "cp775",
+ "csPC775Baltic",
+ "KOI8-U",
+ "csKOI8U",
+ "IBM00858",
+ "CCSID00858",
+ "CP00858",
+ "PC-Multilingual-850+euro",
+ "csIBM00858",
+ "IBM00924",
+ "CCSID00924",
+ "CP00924",
+ "ebcdic-Latin9--euro",
+ "csIBM00924",
+ "IBM01140",
+ "CCSID01140",
+ "CP01140",
+ "ebcdic-us-37+euro",
+ "csIBM01140",
+ "IBM01141",
+ "CCSID01141",
+ "CP01141",
+ "ebcdic-de-273+euro",
+ "csIBM01141",
+ "IBM01142",
+ "CCSID01142",
+ "CP01142",
+ "ebcdic-dk-277+euro",
+ "ebcdic-no-277+euro",
+ "csIBM01142",
+ "IBM01143",
+ "CCSID01143",
+ "CP01143",
+ "ebcdic-fi-278+euro",
+ "ebcdic-se-278+euro",
+ "csIBM01143",
+ "IBM01144",
+ "CCSID01144",
+ "CP01144",
+ "ebcdic-it-280+euro",
+ "csIBM01144",
+ "IBM01145",
+ "CCSID01145",
+ "CP01145",
+ "ebcdic-es-284+euro",
+ "csIBM01145",
+ "IBM01146",
+ "CCSID01146",
+ "CP01146",
+ "ebcdic-gb-285+euro",
+ "csIBM01146",
+ "IBM01147",
+ "CCSID01147",
+ "CP01147",
+ "ebcdic-fr-297+euro",
+ "csIBM01147",
+ "IBM01148",
+ "CCSID01148",
+ "CP01148",
+ "ebcdic-international-500+euro",
+ "csIBM01148",
+ "IBM01149",
+ "CCSID01149",
+ "CP01149",
+ "ebcdic-is-871+euro",
+ "csIBM01149",
+ "Big5-HKSCS",
+ "csBig5HKSCS",
+ "IBM1047",
+ "IBM-1047",
+ "csIBM1047",
+ "PTCP154",
+ "csPTCP154",
+ "PT154",
+ "CP154",
+ "Cyrillic-Asian",
+ "Amiga-1251",
+ "Ami1251",
+ "Amiga1251",
+ "Ami-1251",
+ "csAmiga1251",
+ "KOI7-switched",
+ "csKOI7switched",
+ "BRF",
+ "csBRF",
+ "TSCII",
+ "csTSCII",
+ "CP51932",
+ "csCP51932",
+ "windows-874",
+ "cswindows874",
+ "windows-1250",
+ "cswindows1250",
+ "windows-1251",
+ "cswindows1251",
+ "windows-1252",
+ "cswindows1252",
+ "windows-1253",
+ "cswindows1253",
+ "windows-1254",
+ "cswindows1254",
+ "windows-1255",
+ "cswindows1255",
+ "windows-1256",
+ "cswindows1256",
+ "windows-1257",
+ "cswindows1257",
+ "windows-1258",
+ "cswindows1258",
+ "TIS-620",
+ "csTIS620",
+ "ISO-8859-11",
+ "CP50220",
+ "csCP50220",
+ };
};
_LIBCPP_END_NAMESPACE_STD
>From 676d27fe9149498ec6026597cc3b7524205b6f26 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 9 Feb 2026 23:29:03 -0500
Subject: [PATCH 06/17] Clean up ctor tests
---
.../text_encoding/text_encoding.ctor/id.pass.cpp | 6 +++---
.../text_encoding.ctor/string_view.pass.cpp | 16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
index aadae652d5b91..f0c2c79045b62 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
@@ -22,17 +22,17 @@
using id = std::text_encoding::id;
-constexpr void id_ctor(id i, id expect_id, std::string_view expect_name) {
+constexpr void id_ctor(id i, std::string_view expect_name) {
std::text_encoding te = std::text_encoding(i);
- assert(te.mib() == expect_id);
+ assert(te.mib() == i);
assert(expect_name == te.name());
assert(std::ranges::contains(te.aliases(), expect_name));
}
constexpr void id_ctors() {
for (auto pair : unique_encoding_data) {
- id_ctor(id(pair.mib), id(pair.mib), pair.name);
+ id_ctor(id(pair.mib), pair.name);
}
}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
index 8b92d5fa7fba8..9557e8bb2d4bb 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
@@ -21,11 +21,11 @@
#include "../test_text_encoding.h"
-constexpr void test_ctor(std::string_view str, std::string_view expect, std::text_encoding::id expect_id) {
+constexpr void test_ctor(std::string_view str, std::text_encoding::id expect_id) {
std::text_encoding te = std::text_encoding(str);
assert(te.mib() == expect_id);
- assert(te.name() == expect);
+ assert(te.name() == str);
}
constexpr void test_primary_encoding_spellings() {
@@ -53,27 +53,27 @@ constexpr bool test() {
}
{
- test_ctor("U_T_F-8", "U_T_F-8", std::text_encoding::UTF8);
+ test_ctor("U_T_F-8", std::text_encoding::UTF8);
}
{
- test_ctor("utf8", "utf8", std::text_encoding::UTF8);
+ test_ctor("utf8", std::text_encoding::UTF8);
}
{
- test_ctor("u.t.f-008", "u.t.f-008", std::text_encoding::UTF8);
+ test_ctor("u.t.f-008", std::text_encoding::UTF8);
}
{
- test_ctor("utf-80", "utf-80", std::text_encoding::other);
+ test_ctor("utf-80", std::text_encoding::other);
}
{
- test_ctor("iso885931988", "iso885931988", std::text_encoding::ISOLatin3);
+ test_ctor("iso885931988", std::text_encoding::ISOLatin3);
}
{
- test_ctor("iso00885931988", "iso00885931988", std::text_encoding::ISOLatin3);
+ test_ctor("iso00885931988", std::text_encoding::ISOLatin3);
}
{
>From 770cea800a30868afbe68bedc21379e5b1d7bd86 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Tue, 10 Feb 2026 20:14:21 -0500
Subject: [PATCH 07/17] Remove wrap_iter change
---
libcxx/include/__iterator/wrap_iter.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index a1c8235a46c29..128aeab3ac7cd 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -119,7 +119,6 @@ class __wrap_iter {
friend struct array;
template <class _Tp, class>
friend struct __optional_iterator;
- friend struct __te_impl;
};
template <class _Iter1>
>From 66274460ef757ff82aa3f7929fc2531f73245a8b Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Tue, 10 Feb 2026 20:19:04 -0500
Subject: [PATCH 08/17] Add more GCC steps
---
.../text_encoding/text_encoding.ctor/string_view.pass.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
index 9557e8bb2d4bb..c8d1ed298b421 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
@@ -8,7 +8,7 @@
// REQUIRES: std-at-least-c++26
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=30000000
-// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=99000000
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=1000000000
// <text_encoding>
>From f5869798aac46e6b15a51bbd16feecbdc9900f46 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 19:33:34 -0500
Subject: [PATCH 09/17] Clean up header
---
libcxx/include/__text_encoding/te_impl.h | 13 ++++++++-----
libcxx/include/text_encoding | 19 +++++++------------
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/libcxx/include/__text_encoding/te_impl.h b/libcxx/include/__text_encoding/te_impl.h
index 4c20847b6bc89..630cabf537eff 100644
--- a/libcxx/include/__text_encoding/te_impl.h
+++ b/libcxx/include/__text_encoding/te_impl.h
@@ -65,7 +65,7 @@ struct __te_impl {
INVARIANT = 29,
ISO2IntlRefVersion = 30,
NATSSEFI = 31,
- NATSSEFIADD = 32,
+ NATSSEFIADD = 32, // NATS-DANO (33) and NATS-DANO-ADD (34) are omitted by the standard.
ISO10Swedish = 35,
KSC56011987 = 36,
ISO2022KR = 37,
@@ -372,7 +372,7 @@ struct __te_impl {
const __te_data* __found = std::find_if(__entries + 2, std::end(__entries), __pred);
if (__found == std::end(__entries)) {
- return 0u; // other
+ return __other_idx_; // other
}
return __found - __entries;
@@ -386,7 +386,7 @@ struct __te_impl {
auto __found = std::lower_bound(std::begin(__entries), std::end(__entries), __i);
if (__found == std::end(__entries)) {
- return 1u; // unknown
+ return __unknown_idx_; // unknown
}
return __found - __entries;
@@ -595,9 +595,12 @@ struct __te_impl {
{857, 2108, 2}, {859, 2109, 2}, {861, 2250, 2}, {863, 2251, 2}, {865, 2252, 2}, {867, 2253, 2}, {869, 2254, 2},
{871, 2255, 2}, {873, 2256, 2}, {875, 2257, 2}, {877, 2258, 2}, {879, 2259, 3}, {882, 2260, 2}};
+ static constexpr auto __other_idx_ = 0u;
+ static constexpr auto __unknown_idx_ = 1u;
+
static constexpr char const* __aliases_table[] = {
- "",
- "",
+ "", // other
+ "", // unknown
"US-ASCII",
"iso-ir-6",
"ANSI_X3.4-1968",
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
index 45962b3cc7438..4ae4a8cf6f284 100644
--- a/libcxx/include/text_encoding
+++ b/libcxx/include/text_encoding
@@ -57,23 +57,20 @@ struct text_encoding
*/
-#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/__config>
-#else
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 26
-# include <__config>
# include <__functional/hash.h>
# include <__ranges/enable_borrowed_range.h>
# include <__text_encoding/te_impl.h>
# include <string_view>
# include <version>
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-# if _LIBCPP_STD_VER >= 26
-
_LIBCPP_BEGIN_NAMESPACE_STD
struct text_encoding {
@@ -137,6 +134,4 @@ _LIBCPP_END_NAMESPACE_STD
# endif // _LIBCPP_STD_VER >= 26
-#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-
#endif // _LIBCPP_TEXT_ENCODING
>From f5cadc4c9082471ebbfda3574fa2c0f321463f8c Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 19:43:44 -0500
Subject: [PATCH 10/17] Add enumeration test
---
.../text_encoding.members/id.compile.pass.cpp | 276 ++++++++++++++++++
1 file changed, 276 insertions(+)
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
new file mode 100644
index 0000000000000..d35aabdd3c08b
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
@@ -0,0 +1,276 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <text_encoding>
+
+// std::text_encoding::id;
+// Test that every member of the id enumeration has the correct value.
+
+#include <cstddef>
+#include <text_encoding>
+
+static_assert(int_least32_t(std::text_encoding::id::other) == 1);
+static_assert(int_least32_t(std::text_encoding::id::unknown) == 2);
+static_assert(int_least32_t(std::text_encoding::id::ASCII) == 3);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin1) == 4);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin2) == 5);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin3) == 6);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin4) == 7);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatinCyrillic) == 8);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatinArabic) == 9);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatinGreek) == 10);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatinHebrew) == 11);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin5) == 12);
+static_assert(int_least32_t(std::text_encoding::id::ISOLatin6) == 13);
+static_assert(int_least32_t(std::text_encoding::id::ISOTextComm) == 14);
+static_assert(int_least32_t(std::text_encoding::id::HalfWidthKatakana) == 15);
+static_assert(int_least32_t(std::text_encoding::id::JISEncoding) == 16);
+static_assert(int_least32_t(std::text_encoding::id::ShiftJIS) == 17);
+static_assert(int_least32_t(std::text_encoding::id::EUCPkdFmtJapanese) == 18);
+static_assert(int_least32_t(std::text_encoding::id::EUCFixWidJapanese) == 19);
+static_assert(int_least32_t(std::text_encoding::id::ISO4UnitedKingdom) == 20);
+static_assert(int_least32_t(std::text_encoding::id::ISO11SwedishForNames) == 21);
+static_assert(int_least32_t(std::text_encoding::id::ISO15Italian) == 22);
+static_assert(int_least32_t(std::text_encoding::id::ISO17Spanish) == 23);
+static_assert(int_least32_t(std::text_encoding::id::ISO21German) == 24);
+static_assert(int_least32_t(std::text_encoding::id::ISO60DanishNorwegian) == 25);
+static_assert(int_least32_t(std::text_encoding::id::ISO69French) == 26);
+static_assert(int_least32_t(std::text_encoding::id::ISO10646UTF1) == 27);
+static_assert(int_least32_t(std::text_encoding::id::ISO646basic1983) == 28);
+static_assert(int_least32_t(std::text_encoding::id::INVARIANT) == 29);
+static_assert(int_least32_t(std::text_encoding::id::ISO2IntlRefVersion) == 30);
+static_assert(int_least32_t(std::text_encoding::id::NATSSEFI) == 31);
+static_assert(int_least32_t(std::text_encoding::id::NATSSEFIADD) == 32);
+static_assert(int_least32_t(std::text_encoding::id::ISO10Swedish) == 35);
+static_assert(int_least32_t(std::text_encoding::id::KSC56011987) == 36);
+static_assert(int_least32_t(std::text_encoding::id::ISO2022KR) == 37);
+static_assert(int_least32_t(std::text_encoding::id::EUCKR) == 38);
+static_assert(int_least32_t(std::text_encoding::id::ISO2022JP) == 39);
+static_assert(int_least32_t(std::text_encoding::id::ISO2022JP2) == 40);
+static_assert(int_least32_t(std::text_encoding::id::ISO13JISC6220jp) == 41);
+static_assert(int_least32_t(std::text_encoding::id::ISO14JISC6220ro) == 42);
+static_assert(int_least32_t(std::text_encoding::id::ISO16Portuguese) == 43);
+static_assert(int_least32_t(std::text_encoding::id::ISO18Greek7Old) == 44);
+static_assert(int_least32_t(std::text_encoding::id::ISO19LatinGreek) == 45);
+static_assert(int_least32_t(std::text_encoding::id::ISO25French) == 46);
+static_assert(int_least32_t(std::text_encoding::id::ISO27LatinGreek1) == 47);
+static_assert(int_least32_t(std::text_encoding::id::ISO5427Cyrillic) == 48);
+static_assert(int_least32_t(std::text_encoding::id::ISO42JISC62261978) == 49);
+static_assert(int_least32_t(std::text_encoding::id::ISO47BSViewdata) == 50);
+static_assert(int_least32_t(std::text_encoding::id::ISO49INIS) == 51);
+static_assert(int_least32_t(std::text_encoding::id::ISO50INIS8) == 52);
+static_assert(int_least32_t(std::text_encoding::id::ISO51INISCyrillic) == 53);
+static_assert(int_least32_t(std::text_encoding::id::ISO54271981) == 54);
+static_assert(int_least32_t(std::text_encoding::id::ISO5428Greek) == 55);
+static_assert(int_least32_t(std::text_encoding::id::ISO57GB1988) == 56);
+static_assert(int_least32_t(std::text_encoding::id::ISO58GB231280) == 57);
+static_assert(int_least32_t(std::text_encoding::id::ISO61Norwegian2) == 58);
+static_assert(int_least32_t(std::text_encoding::id::ISO70VideotexSupp1) == 59);
+static_assert(int_least32_t(std::text_encoding::id::ISO84Portuguese2) == 60);
+static_assert(int_least32_t(std::text_encoding::id::ISO85Spanish2) == 61);
+static_assert(int_least32_t(std::text_encoding::id::ISO86Hungarian) == 62);
+static_assert(int_least32_t(std::text_encoding::id::ISO87JISX0208) == 63);
+static_assert(int_least32_t(std::text_encoding::id::ISO88Greek7) == 64);
+static_assert(int_least32_t(std::text_encoding::id::ISO89ASMO449) == 65);
+static_assert(int_least32_t(std::text_encoding::id::ISO90) == 66);
+static_assert(int_least32_t(std::text_encoding::id::ISO91JISC62291984a) == 67);
+static_assert(int_least32_t(std::text_encoding::id::ISO92JISC62991984b) == 68);
+static_assert(int_least32_t(std::text_encoding::id::ISO93JIS62291984badd) == 69);
+static_assert(int_least32_t(std::text_encoding::id::ISO94JIS62291984hand) == 70);
+static_assert(int_least32_t(std::text_encoding::id::ISO95JIS62291984handadd) == 71);
+static_assert(int_least32_t(std::text_encoding::id::ISO96JISC62291984kana) == 72);
+static_assert(int_least32_t(std::text_encoding::id::ISO2033) == 73);
+static_assert(int_least32_t(std::text_encoding::id::ISO99NAPLPS) == 74);
+static_assert(int_least32_t(std::text_encoding::id::ISO102T617bit) == 75);
+static_assert(int_least32_t(std::text_encoding::id::ISO103T618bit) == 76);
+static_assert(int_least32_t(std::text_encoding::id::ISO111ECMACyrillic) == 77);
+static_assert(int_least32_t(std::text_encoding::id::ISO121Canadian1) == 78);
+static_assert(int_least32_t(std::text_encoding::id::ISO122Canadian2) == 79);
+static_assert(int_least32_t(std::text_encoding::id::ISO123CSAZ24341985gr) == 80);
+static_assert(int_least32_t(std::text_encoding::id::ISO88596E) == 81);
+static_assert(int_least32_t(std::text_encoding::id::ISO88596I) == 82);
+static_assert(int_least32_t(std::text_encoding::id::ISO128T101G2) == 83);
+static_assert(int_least32_t(std::text_encoding::id::ISO88598E) == 84);
+static_assert(int_least32_t(std::text_encoding::id::ISO88598I) == 85);
+static_assert(int_least32_t(std::text_encoding::id::ISO139CSN369103) == 86);
+static_assert(int_least32_t(std::text_encoding::id::ISO141JUSIB1002) == 87);
+static_assert(int_least32_t(std::text_encoding::id::ISO143IECP271) == 88);
+static_assert(int_least32_t(std::text_encoding::id::ISO146Serbian) == 89);
+static_assert(int_least32_t(std::text_encoding::id::ISO147Macedonian) == 90);
+static_assert(int_least32_t(std::text_encoding::id::ISO150) == 91);
+static_assert(int_least32_t(std::text_encoding::id::ISO151Cuba) == 92);
+static_assert(int_least32_t(std::text_encoding::id::ISO6937Add) == 93);
+static_assert(int_least32_t(std::text_encoding::id::ISO153GOST1976874) == 94);
+static_assert(int_least32_t(std::text_encoding::id::ISO8859Supp) == 95);
+static_assert(int_least32_t(std::text_encoding::id::ISO10367Box) == 96);
+static_assert(int_least32_t(std::text_encoding::id::ISO158Lap) == 97);
+static_assert(int_least32_t(std::text_encoding::id::ISO159JISX02121990) == 98);
+static_assert(int_least32_t(std::text_encoding::id::ISO646Danish) == 99);
+static_assert(int_least32_t(std::text_encoding::id::USDK) == 100);
+static_assert(int_least32_t(std::text_encoding::id::DKUS) == 101);
+static_assert(int_least32_t(std::text_encoding::id::KSC5636) == 102);
+static_assert(int_least32_t(std::text_encoding::id::Unicode11UTF7) == 103);
+static_assert(int_least32_t(std::text_encoding::id::ISO2022CN) == 104);
+static_assert(int_least32_t(std::text_encoding::id::ISO2022CNEXT) == 105);
+static_assert(int_least32_t(std::text_encoding::id::UTF8) == 106);
+static_assert(int_least32_t(std::text_encoding::id::ISO885913) == 109);
+static_assert(int_least32_t(std::text_encoding::id::ISO885914) == 110);
+static_assert(int_least32_t(std::text_encoding::id::ISO885915) == 111);
+static_assert(int_least32_t(std::text_encoding::id::ISO885916) == 112);
+static_assert(int_least32_t(std::text_encoding::id::GBK) == 113);
+static_assert(int_least32_t(std::text_encoding::id::GB18030) == 114);
+static_assert(int_least32_t(std::text_encoding::id::OSDEBCDICDF0415) == 115);
+static_assert(int_least32_t(std::text_encoding::id::OSDEBCDICDF03IRV) == 116);
+static_assert(int_least32_t(std::text_encoding::id::OSDEBCDICDF041) == 117);
+static_assert(int_least32_t(std::text_encoding::id::ISO115481) == 118);
+static_assert(int_least32_t(std::text_encoding::id::KZ1048) == 119);
+static_assert(int_least32_t(std::text_encoding::id::UCS2) == 1000);
+static_assert(int_least32_t(std::text_encoding::id::UCS4) == 1001);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeASCII) == 1002);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeLatin1) == 1003);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeJapanese) == 1004);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeIBM1261) == 1005);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeIBM1268) == 1006);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeIBM1276) == 1007);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeIBM1264) == 1008);
+static_assert(int_least32_t(std::text_encoding::id::UnicodeIBM1265) == 1009);
+static_assert(int_least32_t(std::text_encoding::id::Unicode11) == 1010);
+static_assert(int_least32_t(std::text_encoding::id::SCSU) == 1011);
+static_assert(int_least32_t(std::text_encoding::id::UTF7) == 1012);
+static_assert(int_least32_t(std::text_encoding::id::UTF16BE) == 1013);
+static_assert(int_least32_t(std::text_encoding::id::UTF16LE) == 1014);
+static_assert(int_least32_t(std::text_encoding::id::UTF16) == 1015);
+static_assert(int_least32_t(std::text_encoding::id::CESU8) == 1016);
+static_assert(int_least32_t(std::text_encoding::id::UTF32) == 1017);
+static_assert(int_least32_t(std::text_encoding::id::UTF32BE) == 1018);
+static_assert(int_least32_t(std::text_encoding::id::UTF32LE) == 1019);
+static_assert(int_least32_t(std::text_encoding::id::BOCU1) == 1020);
+static_assert(int_least32_t(std::text_encoding::id::UTF7IMAP) == 1021);
+static_assert(int_least32_t(std::text_encoding::id::Windows30Latin1) == 2000);
+static_assert(int_least32_t(std::text_encoding::id::Windows31Latin1) == 2001);
+static_assert(int_least32_t(std::text_encoding::id::Windows31Latin2) == 2002);
+static_assert(int_least32_t(std::text_encoding::id::Windows31Latin5) == 2003);
+static_assert(int_least32_t(std::text_encoding::id::HPRoman8) == 2004);
+static_assert(int_least32_t(std::text_encoding::id::AdobeStandardEncoding) == 2005);
+static_assert(int_least32_t(std::text_encoding::id::VenturaUS) == 2006);
+static_assert(int_least32_t(std::text_encoding::id::VenturaInternational) == 2007);
+static_assert(int_least32_t(std::text_encoding::id::DECMCS) == 2008);
+static_assert(int_least32_t(std::text_encoding::id::PC850Multilingual) == 2009);
+static_assert(int_least32_t(std::text_encoding::id::PC8DanishNorwegian) == 2012);
+static_assert(int_least32_t(std::text_encoding::id::PC862LatinHebrew) == 2013);
+static_assert(int_least32_t(std::text_encoding::id::PC8Turkish) == 2014);
+static_assert(int_least32_t(std::text_encoding::id::IBMSymbols) == 2015);
+static_assert(int_least32_t(std::text_encoding::id::IBMThai) == 2016);
+static_assert(int_least32_t(std::text_encoding::id::HPLegal) == 2017);
+static_assert(int_least32_t(std::text_encoding::id::HPPiFont) == 2018);
+static_assert(int_least32_t(std::text_encoding::id::HPMath8) == 2019);
+static_assert(int_least32_t(std::text_encoding::id::HPPSMath) == 2020);
+static_assert(int_least32_t(std::text_encoding::id::HPDesktop) == 2021);
+static_assert(int_least32_t(std::text_encoding::id::VenturaMath) == 2022);
+static_assert(int_least32_t(std::text_encoding::id::MicrosoftPublishing) == 2023);
+static_assert(int_least32_t(std::text_encoding::id::Windows31J) == 2024);
+static_assert(int_least32_t(std::text_encoding::id::GB2312) == 2025);
+static_assert(int_least32_t(std::text_encoding::id::Big5) == 2026);
+static_assert(int_least32_t(std::text_encoding::id::Macintosh) == 2027);
+static_assert(int_least32_t(std::text_encoding::id::IBM037) == 2028);
+static_assert(int_least32_t(std::text_encoding::id::IBM038) == 2029);
+static_assert(int_least32_t(std::text_encoding::id::IBM273) == 2030);
+static_assert(int_least32_t(std::text_encoding::id::IBM274) == 2031);
+static_assert(int_least32_t(std::text_encoding::id::IBM275) == 2032);
+static_assert(int_least32_t(std::text_encoding::id::IBM277) == 2033);
+static_assert(int_least32_t(std::text_encoding::id::IBM278) == 2034);
+static_assert(int_least32_t(std::text_encoding::id::IBM280) == 2035);
+static_assert(int_least32_t(std::text_encoding::id::IBM281) == 2036);
+static_assert(int_least32_t(std::text_encoding::id::IBM284) == 2037);
+static_assert(int_least32_t(std::text_encoding::id::IBM285) == 2038);
+static_assert(int_least32_t(std::text_encoding::id::IBM290) == 2039);
+static_assert(int_least32_t(std::text_encoding::id::IBM297) == 2040);
+static_assert(int_least32_t(std::text_encoding::id::IBM420) == 2041);
+static_assert(int_least32_t(std::text_encoding::id::IBM423) == 2042);
+static_assert(int_least32_t(std::text_encoding::id::IBM424) == 2043);
+static_assert(int_least32_t(std::text_encoding::id::PC8CodePage437) == 2011);
+static_assert(int_least32_t(std::text_encoding::id::IBM500) == 2044);
+static_assert(int_least32_t(std::text_encoding::id::IBM851) == 2045);
+static_assert(int_least32_t(std::text_encoding::id::PCp852) == 2010);
+static_assert(int_least32_t(std::text_encoding::id::IBM855) == 2046);
+static_assert(int_least32_t(std::text_encoding::id::IBM857) == 2047);
+static_assert(int_least32_t(std::text_encoding::id::IBM860) == 2048);
+static_assert(int_least32_t(std::text_encoding::id::IBM861) == 2049);
+static_assert(int_least32_t(std::text_encoding::id::IBM863) == 2050);
+static_assert(int_least32_t(std::text_encoding::id::IBM864) == 2051);
+static_assert(int_least32_t(std::text_encoding::id::IBM865) == 2052);
+static_assert(int_least32_t(std::text_encoding::id::IBM868) == 2053);
+static_assert(int_least32_t(std::text_encoding::id::IBM869) == 2054);
+static_assert(int_least32_t(std::text_encoding::id::IBM870) == 2055);
+static_assert(int_least32_t(std::text_encoding::id::IBM871) == 2056);
+static_assert(int_least32_t(std::text_encoding::id::IBM880) == 2057);
+static_assert(int_least32_t(std::text_encoding::id::IBM891) == 2058);
+static_assert(int_least32_t(std::text_encoding::id::IBM903) == 2059);
+static_assert(int_least32_t(std::text_encoding::id::IBM904) == 2060);
+static_assert(int_least32_t(std::text_encoding::id::IBM905) == 2061);
+static_assert(int_least32_t(std::text_encoding::id::IBM918) == 2062);
+static_assert(int_least32_t(std::text_encoding::id::IBM1026) == 2063);
+static_assert(int_least32_t(std::text_encoding::id::IBMEBCDICATDE) == 2064);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICATDEA) == 2065);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICCAFR) == 2066);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICDKNO) == 2067);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICDKNOA) == 2068);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICFISE) == 2069);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICFISEA) == 2070);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICFR) == 2071);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICIT) == 2072);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICPT) == 2073);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICES) == 2074);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICESA) == 2075);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICESS) == 2076);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICUK) == 2077);
+static_assert(int_least32_t(std::text_encoding::id::EBCDICUS) == 2078);
+static_assert(int_least32_t(std::text_encoding::id::Unknown8BiT) == 2079);
+static_assert(int_least32_t(std::text_encoding::id::Mnemonic) == 2080);
+static_assert(int_least32_t(std::text_encoding::id::Mnem) == 2081);
+static_assert(int_least32_t(std::text_encoding::id::VISCII) == 2082);
+static_assert(int_least32_t(std::text_encoding::id::VIQR) == 2083);
+static_assert(int_least32_t(std::text_encoding::id::KOI8R) == 2084);
+static_assert(int_least32_t(std::text_encoding::id::HZGB2312) == 2085);
+static_assert(int_least32_t(std::text_encoding::id::IBM866) == 2086);
+static_assert(int_least32_t(std::text_encoding::id::PC775Baltic) == 2087);
+static_assert(int_least32_t(std::text_encoding::id::KOI8U) == 2088);
+static_assert(int_least32_t(std::text_encoding::id::IBM00858) == 2089);
+static_assert(int_least32_t(std::text_encoding::id::IBM00924) == 2090);
+static_assert(int_least32_t(std::text_encoding::id::IBM01140) == 2091);
+static_assert(int_least32_t(std::text_encoding::id::IBM01141) == 2092);
+static_assert(int_least32_t(std::text_encoding::id::IBM01142) == 2093);
+static_assert(int_least32_t(std::text_encoding::id::IBM01143) == 2094);
+static_assert(int_least32_t(std::text_encoding::id::IBM01144) == 2095);
+static_assert(int_least32_t(std::text_encoding::id::IBM01145) == 2096);
+static_assert(int_least32_t(std::text_encoding::id::IBM01146) == 2097);
+static_assert(int_least32_t(std::text_encoding::id::IBM01147) == 2098);
+static_assert(int_least32_t(std::text_encoding::id::IBM01148) == 2099);
+static_assert(int_least32_t(std::text_encoding::id::IBM01149) == 2100);
+static_assert(int_least32_t(std::text_encoding::id::Big5HKSCS) == 2101);
+static_assert(int_least32_t(std::text_encoding::id::IBM1047) == 2102);
+static_assert(int_least32_t(std::text_encoding::id::PTCP154) == 2103);
+static_assert(int_least32_t(std::text_encoding::id::Amiga1251) == 2104);
+static_assert(int_least32_t(std::text_encoding::id::KOI7switched) == 2105);
+static_assert(int_least32_t(std::text_encoding::id::BRF) == 2106);
+static_assert(int_least32_t(std::text_encoding::id::TSCII) == 2107);
+static_assert(int_least32_t(std::text_encoding::id::CP51932) == 2108);
+static_assert(int_least32_t(std::text_encoding::id::windows874) == 2109);
+static_assert(int_least32_t(std::text_encoding::id::windows1250) == 2250);
+static_assert(int_least32_t(std::text_encoding::id::windows1251) == 2251);
+static_assert(int_least32_t(std::text_encoding::id::windows1252) == 2252);
+static_assert(int_least32_t(std::text_encoding::id::windows1253) == 2253);
+static_assert(int_least32_t(std::text_encoding::id::windows1254) == 2254);
+static_assert(int_least32_t(std::text_encoding::id::windows1255) == 2255);
+static_assert(int_least32_t(std::text_encoding::id::windows1256) == 2256);
+static_assert(int_least32_t(std::text_encoding::id::windows1257) == 2257);
+static_assert(int_least32_t(std::text_encoding::id::windows1258) == 2258);
+static_assert(int_least32_t(std::text_encoding::id::TIS620) == 2259);
+static_assert(int_least32_t(std::text_encoding::id::CP50220) == 2260);
>From 2de0154428ab3683627e6e3c075053d4c3a1987a Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 20:27:16 -0500
Subject: [PATCH 11/17] Fix iterator
---
libcxx/include/__text_encoding/te_impl.h | 57 ++++++++++++------------
libcxx/include/text_encoding | 2 +-
2 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/libcxx/include/__text_encoding/te_impl.h b/libcxx/include/__text_encoding/te_impl.h
index 630cabf537eff..a66918385e730 100644
--- a/libcxx/include/__text_encoding/te_impl.h
+++ b/libcxx/include/__text_encoding/te_impl.h
@@ -308,16 +308,16 @@ struct __te_impl {
return __enc.__mib_rep_ < static_cast<unsigned short>(__i);
}
- _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_begin() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_begin() const noexcept {
return &__aliases_table[__first_alias_index_];
}
- _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_end() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr const char* const* __aliases_end() const noexcept {
return &__aliases_table[__first_alias_index_ + __num_aliases_];
}
};
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __comp_name(string_view __a, string_view __b) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr bool __comp_name(string_view __a, string_view __b) noexcept {
if (__a.empty() || __b.empty()) {
return false;
}
@@ -359,7 +359,7 @@ struct __te_impl {
return true;
}
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx(string_view __a) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx(string_view __a) noexcept {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__a.size() <= __max_name_length_, "input string_view must have size <= 63");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__a.contains('\0'), "input string_view must not contain '\\0'");
@@ -378,7 +378,7 @@ struct __te_impl {
return __found - __entries;
}
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx_by_id(__id __i) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr unsigned short __find_data_idx_by_id(__id __i) noexcept {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i >= __id::other, "invalid text_encoding::id passed");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i <= __id::CP50220, "invalid text_encoding::id passed");
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __NATS_DANO_, "Mib for NATS-DANO used");
@@ -423,71 +423,65 @@ struct __te_impl {
constexpr __iterator() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return *__data_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const noexcept { return *__data_; }
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const noexcept {
auto __it = *this;
return *(__it + __n);
}
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator->() const { return __data_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator->() const noexcept { return __data_; }
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __it, difference_type __n) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __it, difference_type __n) noexcept {
__it += __n;
return __it;
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __it) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __it) noexcept {
__it += __n;
return __it;
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __it, difference_type __n) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __it, difference_type __n) noexcept {
__it -= __n;
return __it;
}
- _LIBCPP_HIDE_FROM_ABI constexpr difference_type operator-(const __iterator& __other) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr difference_type operator-(const __iterator& __other) const noexcept {
return __data_ - __other.__data_;
}
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(difference_type __n, __iterator& __it) {
- __it -= __n;
- return __it;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() noexcept {
__data_++;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) noexcept {
auto __old = *this;
__data_++;
return __old;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() noexcept {
__data_--;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) noexcept {
auto __old = *this;
__data_--;
return __old;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) {
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) noexcept {
__data_ += __n;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) { return (*this += -__n); }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) noexcept { return (*this += -__n); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const __iterator& __it) const { return __data_ == __it.__data_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(__iterator __it) const { return __data_ <=> __it.__data_; }
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto
+ operator<=>(const __iterator& __it, const __iterator& __it2) noexcept = default;
private:
friend struct __aliases_view;
@@ -497,8 +491,13 @@ struct __te_impl {
const char* const* __data_;
}; // __iterator
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__view_data_->__aliases_begin()}; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const { return __iterator{__view_data_->__aliases_end()}; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const noexcept {
+ return __iterator{__view_data_->__aliases_begin()};
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const noexcept {
+ return __iterator{__view_data_->__aliases_end()};
+ }
private:
friend struct __te_impl;
@@ -507,7 +506,7 @@ struct __te_impl {
const __te_data* __view_data_;
}; // __aliases_view
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view __aliases() const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr __aliases_view __aliases() const noexcept {
return __aliases_view(&__entries[__encoding_idx_]);
}
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
index 4ae4a8cf6f284..289b42333ae4b 100644
--- a/libcxx/include/text_encoding
+++ b/libcxx/include/text_encoding
@@ -90,7 +90,7 @@ public:
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr id mib() const noexcept { return __impl_.__mib(); }
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const char* name() const noexcept { return __impl_.__name(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr aliases_view aliases() const { return __impl_.__aliases(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr aliases_view aliases() const noexcept { return __impl_.__aliases(); }
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const text_encoding& __a, const text_encoding& __b) noexcept {
return __a.__impl_ == __b.__impl_;
>From 675aaa14340923f8da54df23031ac4cc3d1880fc Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 20:32:02 -0500
Subject: [PATCH 12/17] Add noexcept tests
---
.../text_encoding/text_encoding.ctor/default.pass.cpp | 3 ++-
.../utilities/text_encoding/text_encoding.ctor/id.pass.cpp | 3 ++-
.../text_encoding/text_encoding.ctor/string_view.pass.cpp | 7 ++++---
.../text_encoding/text_encoding.eq/equal.id.pass.cpp | 3 ++-
.../text_encoding/text_encoding.eq/equal.pass.cpp | 3 ++-
.../text_encoding.members/aliases_view.compile.pass.cpp | 1 +
.../text_encoding.aliases_view/begin.pass.cpp | 2 ++
.../text_encoding.aliases_view/end.pass.cpp | 3 +++
8 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
index d84b36d86d88f..61e9fe41bab2e 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp
@@ -13,11 +13,12 @@
// text_encoding::text_encoding() noexcept
#include <cassert>
+#include <concepts>
#include <text_encoding>
#include <type_traits>
constexpr bool test() {
- std::text_encoding te = std::text_encoding();
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding();
assert(te.mib() == std::text_encoding::unknown);
assert(std::string_view("") == te.name());
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
index f0c2c79045b62..c7b8a193df573 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp
@@ -14,6 +14,7 @@
#include <algorithm>
#include <cassert>
+#include <concepts>
#include <ranges>
#include <text_encoding>
#include <type_traits>
@@ -23,7 +24,7 @@
using id = std::text_encoding::id;
constexpr void id_ctor(id i, std::string_view expect_name) {
- std::text_encoding te = std::text_encoding(i);
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding(i);
assert(te.mib() == i);
assert(expect_name == te.name());
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
index c8d1ed298b421..2b69b386cba7b 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp
@@ -15,6 +15,7 @@
// text_encoding::text_encoding(string_view) noexcept
#include <cassert>
+#include <concepts>
#include <string_view>
#include <text_encoding>
#include <type_traits>
@@ -22,7 +23,7 @@
#include "../test_text_encoding.h"
constexpr void test_ctor(std::string_view str, std::text_encoding::id expect_id) {
- std::text_encoding te = std::text_encoding(str);
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding(str);
assert(te.mib() == expect_id);
assert(te.name() == str);
@@ -30,7 +31,7 @@ constexpr void test_ctor(std::string_view str, std::text_encoding::id expect_id)
constexpr void test_primary_encoding_spellings() {
for (auto& data : unique_encoding_data) {
- std::text_encoding te = std::text_encoding(data.name);
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding(data.name);
assert(te.mib() == std::text_encoding::id(data.mib));
assert(te.name() == data.name);
@@ -39,7 +40,7 @@ constexpr void test_primary_encoding_spellings() {
constexpr void test_others() {
for (auto& name : other_names) {
- std::text_encoding te = std::text_encoding(name);
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding(name);
assert(te.mib() == std::text_encoding::other);
assert(te.name() == name);
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
index 3dd8b4322e82e..385a3fb523f09 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp
@@ -28,9 +28,10 @@ constexpr void test_primary_encodings() {
}
constexpr bool test() {
- // 1. operator==(const text_encoding&, id) must be noexcept
+ // 1. operator==(const text_encoding&, id) must be noexcept and returns bool
{
std::text_encoding te = std::text_encoding();
+ ASSERT_SAME_TYPE(decltype(te == id::UTF8), bool);
ASSERT_NOEXCEPT(te == id::UTF8);
}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
index eefbf02bc5bcf..c3ba6a6a37490 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp
@@ -20,9 +20,10 @@
using id = std::text_encoding::id;
constexpr bool test() {
- // 1. operator==(const text_encoding&, const text_encoding&) must be noexcept
+ // 1. operator==(const text_encoding&, const text_encoding&) must be noexcept and returns bool
{
ASSERT_NOEXCEPT(std::text_encoding() == std::text_encoding());
+ ASSERT_SAME_TYPE(bool, decltype(std::text_encoding() == std::text_encoding()));
}
// 2. operator==(const text_encoding&, const text_encoding&) returns true if both text_encoding ids are equal
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
index 711ad99476e77..d19bd04d9f077 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases_view.compile.pass.cpp
@@ -21,3 +21,4 @@ static_assert(std::ranges::random_access_range<std::text_encoding::aliases_view>
static_assert(std::ranges::borrowed_range<std::text_encoding::aliases_view>);
static_assert(std::same_as<std::ranges::range_value_t<std::text_encoding::aliases_view>, const char*>);
static_assert(std::same_as<std::ranges::range_reference_t<std::text_encoding::aliases_view>, const char*>);
+static_assert(noexcept(std::text_encoding().aliases()));
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
index 8664eeb6213ab..f07b1a0e754df 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp
@@ -12,6 +12,7 @@
// text_encoding::aliases_view::begin()
+#include "test_macros.h"
#include <cassert>
#include <ranges>
#include <text_encoding>
@@ -23,6 +24,7 @@ constexpr bool test() {
std::text_encoding::aliases_view view1 = te.aliases();
std::text_encoding::aliases_view view2 = te.aliases();
+ ASSERT_NOEXCEPT(view1.begin());
assert(std::ranges::begin(view1) == std::ranges::begin(view2));
assert(view1.begin() == view2.begin());
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
index b19069dd54b77..c1b0c5e9cf310 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/end.pass.cpp
@@ -15,12 +15,15 @@
#include <cassert>
#include <text_encoding>
+#include "test_macros.h"
+
constexpr bool test() {
std::text_encoding a_other = std::text_encoding("foobar");
std::text_encoding::aliases_view other_aliases = a_other.aliases();
// 1. begin() of an aliases_view of "other" is equal to end()
+ ASSERT_NOEXCEPT(other_aliases.end());
assert(other_aliases.begin() == other_aliases.end());
return true;
>From 392f584dc960273b2b09e94ebd00dc6654b8b36e Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 20:47:09 -0500
Subject: [PATCH 13/17] Strengthen iterator tests
---
.../dereference.pass.cpp | 34 +++++++++++
.../iterator.pass.cpp | 59 +++++++++++++++++--
2 files changed, 89 insertions(+), 4 deletions(-)
create mode 100644 libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
new file mode 100644
index 0000000000000..e16b2210ebaef
--- /dev/null
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
+
+// <text_encoding>
+
+// text_encoding::aliases_view::operator[]
+
+#include <cassert>
+#include <string_view>
+#include <text_encoding>
+
+#include "test_macros.h"
+
+constexpr bool test() {
+ std::text_encoding te(std::text_encoding::id::UTF8);
+ std::text_encoding::aliases_view aliases = te.aliases();
+ auto iter = aliases.begin();
+
+ ASSERT_SAME_TYPE(decltype(aliases[0]), const char*);
+ assert(std::string_view(aliases[0]) == "US-ASCII");
+ assert(std::string_view(aliases[1]) == std::string_view(*(iter + 1)));
+}
+
+int main(int, char**) {
+
+}
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
index 63e714c68abd3..fc5bbaa0c9605 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/iterator.pass.cpp
@@ -16,7 +16,9 @@
#include <compare>
#include <string_view>
#include <text_encoding>
-#include <utility>
+#include <type_traits>
+
+#include "test_macros.h"
constexpr bool test() {
// Test iterator operators.
@@ -26,12 +28,14 @@ constexpr bool test() {
auto j = te.aliases().begin();
auto k = te.aliases().end();
- static_assert(std::three_way_comparable<decltype(i), std::strong_ordering>);
+ static_assert(std::three_way_comparable<decltype(i)>);
{
assert(i == j);
assert(i != k);
- assert((i <=> j) == std::strong_ordering::equal);
+ assert(i <= j);
+ assert(i >= j);
+ assert(i <=> j == std::strong_ordering::equal);
assert(std::string_view(*i) == std::string_view(*j));
}
{
@@ -41,7 +45,10 @@ constexpr bool test() {
{
i++;
assert(i > j);
- assert((i <=> j) == std::strong_ordering::greater);
+ assert(i >= j);
+ assert(!(i <= j));
+ assert(i <=> j == std::strong_ordering::greater);
+ assert(i - j == 1);
assert(std::string_view(*i) != std::string_view(*j));
}
{
@@ -92,6 +99,50 @@ constexpr bool test() {
assert(j != tempj && (tempj - j) == 3);
}
+ { // noexcept
+ ASSERT_NOEXCEPT(*i);
+ ASSERT_NOEXCEPT(i[0]);
+ ASSERT_NOEXCEPT(i.operator->());
+ ASSERT_NOEXCEPT(i + 1);
+ ASSERT_NOEXCEPT(1 + i);
+ ASSERT_NOEXCEPT(i - 1);
+ ASSERT_NOEXCEPT(i - j);
+ ASSERT_NOEXCEPT(i++);
+ ASSERT_NOEXCEPT(++i);
+ ASSERT_NOEXCEPT(i--);
+ ASSERT_NOEXCEPT(--i);
+ ASSERT_NOEXCEPT(i += 2);
+ ASSERT_NOEXCEPT(i -= 2);
+ ASSERT_NOEXCEPT(i == j);
+ ASSERT_NOEXCEPT(i != k);
+ ASSERT_NOEXCEPT(i <=> j);
+ ASSERT_NOEXCEPT(i > j);
+ ASSERT_NOEXCEPT(i < j);
+ ASSERT_NOEXCEPT(i >= j);
+ ASSERT_NOEXCEPT(i <= j);
+ }
+ { // iterator operator return types
+ ASSERT_SAME_TYPE(const char*, decltype(*i));
+ ASSERT_SAME_TYPE(const char*, decltype(i[0]));
+ ASSERT_SAME_TYPE(const char* const*, decltype(i.operator->()));
+ ASSERT_SAME_TYPE(decltype(i), decltype(i + 1));
+ ASSERT_SAME_TYPE(decltype(i), decltype(1 + i));
+ ASSERT_SAME_TYPE(decltype(i), decltype(i - 1));
+ ASSERT_SAME_TYPE(std::add_lvalue_reference_t<decltype(i)>, decltype(++i));
+ ASSERT_SAME_TYPE(decltype(i), decltype(i++));
+ ASSERT_SAME_TYPE(std::add_lvalue_reference_t<decltype(i)>, decltype(--i));
+ ASSERT_SAME_TYPE(decltype(i), decltype(i--));
+ ASSERT_SAME_TYPE(std::add_lvalue_reference_t<decltype(i)>, decltype(i += 1));
+ ASSERT_SAME_TYPE(std::add_lvalue_reference_t<decltype(i)>, decltype(i -= 1));
+ ASSERT_SAME_TYPE(bool, decltype(i == j));
+ ASSERT_SAME_TYPE(bool, decltype(i != j));
+ ASSERT_SAME_TYPE(bool, decltype(i > j));
+ ASSERT_SAME_TYPE(bool, decltype(i < j));
+ ASSERT_SAME_TYPE(bool, decltype(i >= j));
+ ASSERT_SAME_TYPE(bool, decltype(i <= j));
+ ASSERT_SAME_TYPE(std::strong_ordering, decltype(i <=> j));
+ }
+
return true;
}
>From b3886411779bf3e4584b4d7e0ef94d2349015593 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 20:50:16 -0500
Subject: [PATCH 14/17] Update transitive includes
---
.../test/libcxx/transitive_includes/cxx03.csv | 33 ------------------
.../test/libcxx/transitive_includes/cxx11.csv | 33 ------------------
.../test/libcxx/transitive_includes/cxx14.csv | 34 -------------------
.../test/libcxx/transitive_includes/cxx17.csv | 33 ------------------
.../test/libcxx/transitive_includes/cxx20.csv | 33 ------------------
.../test/libcxx/transitive_includes/cxx23.csv | 13 -------
6 files changed, 179 deletions(-)
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 7d8aad95f3b8c..c0031543e47bc 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -2282,39 +2282,6 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
-text_encoding algorithm
-text_encoding atomic
-text_encoding bit
-text_encoding cctype
-text_encoding climits
-text_encoding cmath
-text_encoding compare
-text_encoding concepts
-text_encoding cstddef
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstdlib
-text_encoding cstring
-text_encoding ctime
-text_encoding cwchar
-text_encoding cwctype
-text_encoding exception
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding iterator
-text_encoding limits
-text_encoding memory
-text_encoding new
-text_encoding optional
-text_encoding ratio
-text_encoding stdexcept
-text_encoding string_view
-text_encoding tuple
-text_encoding type_traits
-text_encoding typeinfo
-text_encoding utility
-text_encoding variant
-text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 7d8aad95f3b8c..c0031543e47bc 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -2282,39 +2282,6 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
-text_encoding algorithm
-text_encoding atomic
-text_encoding bit
-text_encoding cctype
-text_encoding climits
-text_encoding cmath
-text_encoding compare
-text_encoding concepts
-text_encoding cstddef
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstdlib
-text_encoding cstring
-text_encoding ctime
-text_encoding cwchar
-text_encoding cwctype
-text_encoding exception
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding iterator
-text_encoding limits
-text_encoding memory
-text_encoding new
-text_encoding optional
-text_encoding ratio
-text_encoding stdexcept
-text_encoding string_view
-text_encoding tuple
-text_encoding type_traits
-text_encoding typeinfo
-text_encoding utility
-text_encoding variant
-text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index bbdb10a75993d..c2eb5b44e8d7a 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -2328,40 +2328,6 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
-text_encoding algorithm
-text_encoding atomic
-text_encoding bit
-text_encoding cctype
-text_encoding climits
-text_encoding cmath
-text_encoding compare
-text_encoding concepts
-text_encoding cstddef
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstdlib
-text_encoding cstring
-text_encoding ctime
-text_encoding cwchar
-text_encoding cwctype
-text_encoding exception
-text_encoding execution
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding iterator
-text_encoding limits
-text_encoding memory
-text_encoding new
-text_encoding optional
-text_encoding ratio
-text_encoding stdexcept
-text_encoding string_view
-text_encoding tuple
-text_encoding type_traits
-text_encoding typeinfo
-text_encoding utility
-text_encoding variant
-text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 53b8325423fa9..332cb62f35b5f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -2335,39 +2335,6 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
-text_encoding algorithm
-text_encoding atomic
-text_encoding bit
-text_encoding cctype
-text_encoding climits
-text_encoding cmath
-text_encoding compare
-text_encoding concepts
-text_encoding cstddef
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstdlib
-text_encoding cstring
-text_encoding ctime
-text_encoding cwchar
-text_encoding cwctype
-text_encoding exception
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding iterator
-text_encoding limits
-text_encoding memory
-text_encoding new
-text_encoding optional
-text_encoding ratio
-text_encoding stdexcept
-text_encoding string_view
-text_encoding tuple
-text_encoding type_traits
-text_encoding typeinfo
-text_encoding utility
-text_encoding variant
-text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index f15b13738dd8a..55c79acff5a8f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -2365,39 +2365,6 @@ system_error typeinfo
system_error utility
system_error variant
system_error version
-text_encoding algorithm
-text_encoding atomic
-text_encoding bit
-text_encoding cctype
-text_encoding climits
-text_encoding cmath
-text_encoding compare
-text_encoding concepts
-text_encoding cstddef
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstdlib
-text_encoding cstring
-text_encoding ctime
-text_encoding cwchar
-text_encoding cwctype
-text_encoding exception
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding iterator
-text_encoding limits
-text_encoding memory
-text_encoding new
-text_encoding optional
-text_encoding ratio
-text_encoding stdexcept
-text_encoding string_view
-text_encoding tuple
-text_encoding type_traits
-text_encoding typeinfo
-text_encoding utility
-text_encoding variant
-text_encoding version
thread algorithm
thread array
thread atomic
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 4714f5f9ca0ba..c5cc61f06678c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -1069,19 +1069,6 @@ system_error string
system_error string_view
system_error tuple
system_error version
-text_encoding cctype
-text_encoding compare
-text_encoding cstdint
-text_encoding cstdio
-text_encoding cstring
-text_encoding cwchar
-text_encoding cwctype
-text_encoding initializer_list
-text_encoding iosfwd
-text_encoding limits
-text_encoding stdexcept
-text_encoding string_view
-text_encoding version
thread array
thread atomic
thread bitset
>From 4e0d87b0bd0a2698f4bfe5c6b12f1ae5ad328b7f Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 21:30:16 -0500
Subject: [PATCH 15/17] Formatting + missed test change
---
libcxx/include/text_encoding | 8 ++++----
.../text_encoding.aliases_view/dereference.pass.cpp | 9 ++++++---
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
index 289b42333ae4b..706b294130df4 100644
--- a/libcxx/include/text_encoding
+++ b/libcxx/include/text_encoding
@@ -103,7 +103,7 @@ public:
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static consteval text_encoding literal() noexcept {
return text_encoding(__te_impl::__literal());
}
-# if _LIBCPP_HAS_LOCALIZATION && !defined(__ANDROID__)
+# if _LIBCPP_HAS_LOCALIZATION && !defined(__ANDROID__)
[[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static text_encoding environment() {
return text_encoding(__te_impl::__environment());
};
@@ -112,12 +112,12 @@ public:
[[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static bool environment_is() {
return __te_impl::__environment_is<_Id>();
}
-# else
+# else
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static text_encoding environment() = delete;
template <id _Id>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool environment_is() = delete;
-# endif
+# endif
};
template <>
@@ -132,6 +132,6 @@ inline constexpr bool ranges::enable_borrowed_range<text_encoding::aliases_view>
_LIBCPP_END_NAMESPACE_STD
-# endif // _LIBCPP_STD_VER >= 26
+#endif // _LIBCPP_STD_VER >= 26
#endif // _LIBCPP_TEXT_ENCODING
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
index e16b2210ebaef..3ea75aa4e2867 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/dereference.pass.cpp
@@ -22,13 +22,16 @@
constexpr bool test() {
std::text_encoding te(std::text_encoding::id::UTF8);
std::text_encoding::aliases_view aliases = te.aliases();
- auto iter = aliases.begin();
+ auto iter = aliases.begin();
ASSERT_SAME_TYPE(decltype(aliases[0]), const char*);
- assert(std::string_view(aliases[0]) == "US-ASCII");
+ assert(std::string_view(aliases[0]) == *iter);
assert(std::string_view(aliases[1]) == std::string_view(*(iter + 1)));
+
+ return true;
}
int main(int, char**) {
-
+ test();
+ static_assert(test());
}
>From 21162d02cae176ff8e04e937d85cc5297a32bd4b Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 22:00:50 -0500
Subject: [PATCH 16/17] Fix test failures
---
libcxx/include/text_encoding | 35 +++++++++++--------
.../text_encoding.members/id.compile.pass.cpp | 2 +-
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
index 706b294130df4..5d849fadaeba7 100644
--- a/libcxx/include/text_encoding
+++ b/libcxx/include/text_encoding
@@ -57,20 +57,25 @@ struct text_encoding
*/
-#include <__config>
+#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
+# include <__cxx03/__config>
+#else
+# include <__config>
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 26
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
-# include <__functional/hash.h>
-# include <__ranges/enable_borrowed_range.h>
-# include <__text_encoding/te_impl.h>
-# include <string_view>
# include <version>
+# if _LIBCPP_STD_VER >= 26
+
+# include <__functional/hash.h>
+# include <__ranges/enable_borrowed_range.h>
+# include <__ranges/view_interface.h>
+# include <__text_encoding/te_impl.h>
+# include <string_view>
+
_LIBCPP_BEGIN_NAMESPACE_STD
struct text_encoding {
@@ -103,7 +108,7 @@ public:
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static consteval text_encoding literal() noexcept {
return text_encoding(__te_impl::__literal());
}
-# if _LIBCPP_HAS_LOCALIZATION && !defined(__ANDROID__)
+# if _LIBCPP_HAS_LOCALIZATION && !defined(__ANDROID__)
[[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static text_encoding environment() {
return text_encoding(__te_impl::__environment());
};
@@ -112,12 +117,12 @@ public:
[[nodiscard]] _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI static bool environment_is() {
return __te_impl::__environment_is<_Id>();
}
-# else
+# else
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static text_encoding environment() = delete;
template <id _Id>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool environment_is() = delete;
-# endif
+# endif
};
template <>
@@ -132,6 +137,8 @@ inline constexpr bool ranges::enable_borrowed_range<text_encoding::aliases_view>
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STD_VER >= 26
+# endif // _LIBCPP_STD_VER >= 26
+
+#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
#endif // _LIBCPP_TEXT_ENCODING
diff --git a/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp b/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
index d35aabdd3c08b..f1a22845d37a1 100644
--- a/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
+++ b/libcxx/test/std/utilities/text_encoding/text_encoding.members/id.compile.pass.cpp
@@ -13,7 +13,7 @@
// std::text_encoding::id;
// Test that every member of the id enumeration has the correct value.
-#include <cstddef>
+#include <cstdint>
#include <text_encoding>
static_assert(int_least32_t(std::text_encoding::id::other) == 1);
>From 3ee8f25844f4841da5101e3bdb55f8a7685f2a84 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <wtranviet at proton.me>
Date: Mon, 23 Feb 2026 22:48:55 -0500
Subject: [PATCH 17/17] Move version header
---
libcxx/include/text_encoding | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libcxx/include/text_encoding b/libcxx/include/text_encoding
index 5d849fadaeba7..f3e6c63a15e3b 100644
--- a/libcxx/include/text_encoding
+++ b/libcxx/include/text_encoding
@@ -66,8 +66,6 @@ struct text_encoding
# pragma GCC system_header
# endif
-# include <version>
-
# if _LIBCPP_STD_VER >= 26
# include <__functional/hash.h>
@@ -75,6 +73,7 @@ struct text_encoding
# include <__ranges/view_interface.h>
# include <__text_encoding/te_impl.h>
# include <string_view>
+# include <version>
_LIBCPP_BEGIN_NAMESPACE_STD
More information about the libcxx-commits
mailing list