2017-03-27 23:46:34 +00:00
|
|
|
|
|
|
|
|
2017-07-25 19:14:31 +00:00
|
|
|
#include <string>
|
2023-09-08 02:09:26 +00:00
|
|
|
#include <core/utf8.h>
|
2017-03-27 23:46:34 +00:00
|
|
|
#include <wx/string.h>
|
|
|
|
|
2017-07-25 19:14:31 +00:00
|
|
|
|
|
|
|
void callee( const wxString& aString )
|
|
|
|
{
|
|
|
|
UTF8 arg = aString;
|
|
|
|
|
|
|
|
printf( "%s: '%s'\n", __func__, arg.c_str() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-27 23:46:34 +00:00
|
|
|
int main( int argc, char** argv )
|
|
|
|
{
|
2018-10-17 14:31:11 +00:00
|
|
|
UTF8 bozo = "This is a test of UTF-8: ü‱☺😕😱";
|
2017-03-27 23:46:34 +00:00
|
|
|
|
2017-07-25 19:14:31 +00:00
|
|
|
callee( bozo );
|
2017-03-27 23:46:34 +00:00
|
|
|
|
|
|
|
wxString s = bozo;
|
|
|
|
|
2018-10-17 14:31:11 +00:00
|
|
|
UTF8 b = s;
|
2017-07-25 19:14:31 +00:00
|
|
|
|
|
|
|
if( s.IsEmpty() )
|
|
|
|
{
|
|
|
|
printf( "string is empty\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( s != bozo.wx_str() )
|
|
|
|
{
|
2018-10-17 14:31:11 +00:00
|
|
|
printf( "wxString conversion error\n" );
|
2017-07-25 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
2018-10-17 14:31:11 +00:00
|
|
|
if( b != bozo )
|
|
|
|
{
|
|
|
|
printf( "From string conversion error\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
auto pos = bozo.begin();
|
|
|
|
auto end = bozo.end();
|
|
|
|
|
|
|
|
while( pos != end )
|
|
|
|
{
|
|
|
|
printf( "%c", *pos++ );
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
2017-03-27 23:46:34 +00:00
|
|
|
return 0;
|
2017-07-25 19:14:31 +00:00
|
|
|
}
|