Questions tagged [boost-locale]

Boost.Locale is a C++ library that provides high quality localization facilities in a C++ way.

Boost.Locale is a C++ library that provides high quality localization facilities in a C++ way.

52 questions
12
votes
4 answers

Read/Write file with unicode file name with plain C++/Boost

I want to read / write a file with a unicode file name using boost filesystem, boost locale on Windows (mingw) (should be platform independent at the end). This is my code: #include #define BOOST_NO_CXX11_SCOPED_ENUMS #include…
Mike M
  • 2,263
  • 3
  • 17
  • 31
6
votes
1 answer

stod does not work correctly with boost::locale

I am trying to use boost::locale and std::stod together in a german locale where a comma is the decimal separator. Consider this code: boost::locale::generator gen; std::locale loc(""); // (1) //std::locale loc = gen(""); //…
NicolasR
  • 2,222
  • 3
  • 23
  • 38
6
votes
1 answer

Using boost::locale/ICU boundary analysis with Chinese

Using the sample code from the boost::locale documentation, I can't get the following to correctly tokenize Chinese text: using namespace boost::locale::boundary; boost::locale::generator gen; std::string text="中華人民共和國"; ssegment_index…
Uri Granta
  • 1,814
  • 14
  • 25
4
votes
2 answers

char8_t and utf8everywhere: How to convert to const char* APIs without invoking undefined behaviour?

As this question is some years old Is C++20 'char8_t' the same as our old 'char'? I would like to know, what is the recommended way to handle the char8_t and char conversion right now? boost::nowide (1.80.0) doesn´t not yet understand char8_t nor…
schorsch_76
  • 794
  • 5
  • 19
4
votes
3 answers

Build Boost.Locale with iconv for iOS

I'm currently trying to build Boost.Locale for iOS, but I can't get it to find the iconv lib (I'm successfully building other parts of Boost for iOS, such as thread or filesystem). I've tried to let Boost.Build find it by itself, I've tried to set…
JBL
  • 12,588
  • 4
  • 53
  • 84
4
votes
1 answer

boost::locale::to_lower throw bad_cast exception

Boost 1.54 x64 on Win 7 64bits and VS2010. Compiling as "Release x64" and running the following code: #include std::wstring y = L"NoNseNSE"; std::wstring w = boost::locale::to_lower(y); throw std::bad_cast exception.…
SiliconValley
  • 1,465
  • 17
  • 30
4
votes
1 answer

boost::locale to_utf function for string encoding, likes to throw

I'm having trouble using boost to convert between different string encoding. After reading this, I tried doing this: boost::locale::generator gen; std::locale loc = gen.generate("");// encoding local to the computer. //std::locale loc =…
DiscoStu
  • 559
  • 6
  • 15
3
votes
0 answers

cmake, boost locale and a static library

I have two applications and a static library used by both. All three using CMake as build system. I want to localize my applications. I more or less understand how to localize applications but I'm not sure how I should localize my static library. If…
Martin Fehrs
  • 792
  • 4
  • 13
3
votes
4 answers

How to convert a codepoint to utf-8?

I have some code that reads in an a unicode codepoint (as escaped in a string 0xF00). Since im using boost, I'm speculating if the following is best (and correct) approach: unsigned int…
darune
  • 10,480
  • 2
  • 24
  • 62
3
votes
0 answers

Unable to statically link boost-locale due to libicu linking errors on Ubuntu 18.04

The following code: #include int main() { using namespace boost::locale; generator gen; } Built with the following flags: g++ -static -static-libstdc++ -pthread main.cpp -lboost_locale -lboost_system -licuuc -licudata…
Adrian17
  • 433
  • 2
  • 6
  • 33
3
votes
1 answer

Boost locale "Conversion failed" for gettext

When I'm running this example code from boost #include #include using namespace std; using namespace boost::locale; int main() { generator gen; // Specify location of dictionaries …
Gelldur
  • 11,187
  • 7
  • 57
  • 68
3
votes
2 answers

Get the user's codepage name for functions in boost::locale::conv

The task at hand I'm parsing a filename from an UTF-8 encoded XML on Windows. I need to pass that filename on to a function that I can't change. Internally it uses _fsopen() which does not support Unicode strings. Current approach My current…
Brandlingo
  • 2,817
  • 1
  • 22
  • 34
3
votes
0 answers

boost::locale behaves differently on two separate but identical systems

I have this program: int main() { using namespace boost::locale; generator gen; std::locale::global(gen("")); calendar cal("UTC"); calendar cal_local("Europe/Berlin"); date_time dt_utc(std::time(0), cal); date_time…
HAL
  • 3,888
  • 3
  • 19
  • 28
3
votes
0 answers

How to format incomplete dates and times in a locale specific manner

How can one format incomplete dates and/or a times in a locale specific manner? I have a date/time stored in a set of 7 strings: dayOfWeek - The day of the week. ([1,7]) dayOfMonth - The day of the month. ([1,31]) monthOfYear - The month of the…
Kelly Davis
  • 161
  • 6
3
votes
1 answer

std::isalpha throws bad_cast when using with boost::locale

I have some troubles with using boost::locale (1.49) on Debian 7 GNU/Linux (version of GCC is 4.6.3-1). The code is saved in cp1251. Using functions like "isalpha" (or "boost::algorithm::is_alpha") ends up with exception (bad_cast). Looks like that…
Nemo
  • 155
  • 1
  • 7
1
2 3 4