Re: [Cppunit-devel] Toward True Unicode Code... Help requested
Brought to you by:
blep
From: Duane M. <dua...@ma...> - 2002-04-14 17:35:45
|
My two cents for what its worth is to do nothing. There is no "True" Unicode. There are several unicode formats. UTF-8, UTF-16, and the upcoming UTF-32 among others. I have been told by some associates that keep up with such things that UTF-16, while currently being used, is on its way out in favor of UTF-32. It is most often recommended to use the simple UTF-8 for most applications. UTF-8 will likely satisfy most of us and require absolutlely no changes. UTF-8 is completely compatible with ASCII (for characters < 128). UTF-8 fits nicely in a standard string. Anyone that is concerned about such things has already worked around any problems involved in using UTF-8 with std::string. This mostly involved parsing and locating character seperations which is of little concern to CppUnit. Another reason to do nothing is that I would hope that the C++ standards committee at least makes some statement about Unicode or internationalization. They have done lots of work to put in infrastructure that very few people really understand. I believe that they need to make some statement or show some examples of how to truly deal with Unicode. My recommendation is to do nothing. Is there some other driving factor behind this decision? --- At Fri, 14 Jun 2002 12:11:46 +0200, Baptiste Lepilleur wrote: > I intend to give CppUnit true UNICODEsupport in assertion message (the >description of the failure, returned by Exception::what()). > > CppUnit should be able to deal with *both* ANSI and UNICODE string. It's >likely that not every unit tests in a project will use one of those >exclusively. > > The current solution I found to this problem is to introduce a wrapper >string class that can be constructed from either ANSI or UNICODE string >(kind of like the MFC CString). That class would also provides accessor to >retreive the string as either ANSI or UNICODE. Conversion from on format to >another would be done automatically. > > Exception and NotEqualException would be modified to use the string >class described above, as well as Asserter functions (functions that 'do' >the assertion by creating the Exception and throwing it). > > That solution have the advantage of having little impact on the existing >code (both CppUnit and user). Most impact will likely be on Outputter (I >have some really twistest ideas for this, but that for later). Does anybody >see another solution ? Suggestions ? > > On a more technical side, I'm not very familar with Unicode on Windows >(never made an application that truely use Unicode), and just about nothing >on Unix. So here are some questions: > > 1) Is std::wstring available on all plateform ? > 2) Are std::wcout, std::wcerr available on all plateform ? > 3) Is the attached code fragment the correct way to do the conversion >between std::string and std::wstring on Windows. > 4) How do we do the conversion on Unix ? Would a dummy conversion (to >and fro iso-latin1) do ? ...Duane -- "If tyranny and oppression come to this land, it will be in the guise of fighting a foreign enemy." - James Madison |