boostorg / locale

Boost.Locale
Boost Software License 1.0
32 stars 70 forks source link

Confused with the expected behavior regarding the capitalization of “ß” #51

Closed olivier-grech closed 1 year ago

olivier-grech commented 4 years ago

This example (https://www.boost.org/doc/libs/1_71_0/libs/locale/doc/html/conversions.html) indicates that the correct case for the word "grüßen" is as follow:

Upper GRÜSSEN
Lower grüßen
Title Grüßen
Fold  grüssen

However, the wording used in the example examples/conversions.cpp seems to indicate that replacing ß by SS is incorrect when using uppercase :

cout<<"For example:"<<endl;
cout<<"   German grüßen correctly converted to "<<to_upper("grüßen")<<", instead of incorrect "
                <<boost::to_upper_copy(std::string("grüßen"))<<endl;
cout<<"     where ß is replaced with SS"<<endl;

I tried running this example (note that I used Boost 1.71), and this is the result I get:

For example:
   German grüßen correctly converted to GRÜßEN, instead of incorrect GRüßEN
     where ß is replaced with SS

...and now I'm even more confused. What is the actual expected behavior for this case?

artyom-beilis commented 4 years ago

Make sure boost.locale is compiled with ICU. conversion of ß to SS supported only in ICU backend

olivier-grech commented 4 years ago

Independently of the result I get by compiling on my machine, could you clarify the discrepancy between the documentation and the example in the code?

Flamefire commented 1 year ago

Independently of the result I get by compiling on my machine, could you clarify the discrepancy between the documentation and the example in the code?

I see the source of the confusion. The part "where ß is replaced with SS" refers to the correct, i.e. expected behavior.

Fixing the example to read:

German grüßen would be incorrectly converted to GRÜßEN, while Boost.Locale converts it to GRÜSSEN where ß is replaced with SS.

I hope that's easier to understand.

olivier-grech commented 1 year ago

This is much more clear, thanks.