[Cppunit-devel] Toward True Unicode Code... Help requested
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2002-04-14 10:06:07
|
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 ? Thanks in advance, Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/ |