On May 20, 12:02*am, Joshua Maurice <joshuamaur...@gmail.com> wrote:
> On May 19, 1:50*am, Öö Tiib <oot...@hot.ee> wrote:
> > On May 19, 8:24*am, "Mihai N." <nmihai_year_2...@yahoo.com> wrote:
>
> > > > I perhaps have too low experience with sophisticated text processing.
> > > > Simple std::sort(), wide char literals of C++ and boost::wformat plus
> > > > full set of conversion functions is all i need really.
>
> > > It depends a lot what you need.
>
> > > Sorting is locale-sensitive (German, Swedish, French, Spanish, all
> > > have different sorting rules).
> > > The CRT (and STL, and boost) are pretty dumb when dealing with things
> > > in a locale sensitive way (meaning that they usualy don't 
>
> > Yes, sorting in real alphabetic order for user is perhaps business of
> > GUI. GUI has to display it. GUI however usually has its WxStrings or
> > FooStrings anyway. I hate when someone leaks these weirdos to
> > application mechanics layer. Internal application logic is often best
> > made totally locale-agnostic and not caring about positioning in GUI
> > and if the end-users write from up to down or from right to left.
>
> > So text in electronic interfaces layer are bytes, text in application
> > layer are wchar_t and text in user interface layer are whatever weirdo
> > rules there. If maintainer forgets to convert in interface between
> > layers he gets compiler warnings or errors. That makes life easy, but
> > i suspect my problems with texts are more trivial than these of some
> > others.
>
> First, as I mentioned in the other current thread on Unicode, please
> stop saying "wchar_t" and "wstring" as though that means something, or
> is at all a useful portable tool. wchar_t is 16 bits on windows, and
> 32 bits on most Unix-like systems IIRC. (Yes, the other thread listed
> some more exceptions.) So, either you're suggesting an entirely not
> portable solution with wstring, or you are suggesting that it makes
> sense to use UTF32 on Unix-like computers and UTF16 on windows
> computers, a quite silly statement.
Now ... seems that there is strange misunderstanding. For anyone
converting between whatever char sequence to whatever wchar_t sequence
it is highly-platform-dependent-operation anyway. I have no way said
that such operations are portable. Since wstring is used for
internally holding texts the sizeof(wchar_t) is not affecting
anything. The major property of wchar_t for me is that it is different
from char on all platforms i know and so i get warnings/errors from
tools on attempts to mechanically assign one to other.
> Then, locales in my experience have not been terribly portable, not
> portable enough for my company's product which runs on nearly all
> computer OSs known to man, including windows, win x64, the so to be
> "desupported by windows" windows itanium, Linux, z Linux, OS 2, HPUX
> IPF, and so on.
You managed to somehow have portability in string-to-string
conversions? Congrats. I have abandoned all hope there. Different code
is used for conversions platform-by-platform. The platform makers (and
not only) seemingly fight with each other to make their data
incompatible so why should i hope there will be peace and portability
any day? Is there something new? Same goes on with dates, values with
measurement units and even plain floating point numbers ... only name
it. Plain text is nothing different.
> Moreover, it's not terribly practical to tell our
> customers "you have to install these 'x' locales". Moreover, the
> locales of the same name on different OSs have been known to have
> subtly different behavior.
Exactly! So portability and localization is possible only by having
converter for each platform that does know the quirks of platform. If
sizeof(wchar_t) is 2 or 4 does not matter at all since code that
produces it is anyway different.
> Finally, I can't think of a useful example off the top of my head
> where sorting based on locale would be required except when
> "printing", to the screen, file, etc., but this doesn't convince me
> that there is no use for it.
No need to nail me. I only confirm that i have not meet a need for it,
but i can not prove that it does not exist. I fight problems that i
meet on field, not theoretical possibilities.
As a potential example, should you have
> to bring in an entire GUI framework just to implement the Unix utility
> "sort" except with an additional locale option? That seems silly to
> me.
No. GUI sorts if there is GUI and printing is part of GUI (if it
really deserves to be named GUI that is). If it goes elsewhere then it
is not a GUI and so why should i sort without user to see it? As for
GUI I am optimistic there. GUI sorts based on the things it uses. For
example:
bool QString:

perator< ( const QString & other ) const {}
In theoretical failure on particular case/platform/locale i would get
defect report, can forward a bug to Nokia and meanwhile write some
custom operator to be used instead:
bool hack::broken_platform_name_here::less( const QString & one,
const QString & another);
In practice however it seems to work or is classified cosmetic or
minor problem. Such do not affect success.