From 9b72e4a8be205c6b0572f110158f8634a60f0e22 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 24 Nov 2005 11:09:00 +0000 Subject: [PATCH] Fix for Chinese locales: LCMapString can't map all 256 characters. See https://sourceforge.net/tracker/?func=detail&atid=207586&aid=1358740&group_id=7586 [SVN r31766] --- src/w32_regex_traits.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index 7d850653..20e84d15 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -105,7 +105,14 @@ void w32_regex_traits_char_layer::init() for(int ii = 0; ii < (1 << CHAR_BIT); ++ii) char_map[ii] = static_cast(ii); int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT); - BOOST_ASSERT(r == 1 << CHAR_BIT); + BOOST_ASSERT(r != 0); + if(r < (1 << CHAR_BIT)) + { + // if we have multibyte characters then not all may have been given + // a lower case mapping: + for(int jj = r; jj < (1 << CHAR_BIT); ++jj) + this->m_lower_map[jj] = static_cast(jj); + } r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map); BOOST_ASSERT(0 != r); }