kicad/tools/utf8_tests.cpp

53 lines
763 B
C++
Raw Normal View History

2017-03-27 23:46:34 +00:00
#include <string>
2017-03-27 23:46:34 +00:00
#include <utf8.h>
#include <wx/string.h>
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 )
{
UTF8 bozo = "This is a test of UTF-8: ü‱☺😕😱";
2017-03-27 23:46:34 +00:00
callee( bozo );
2017-03-27 23:46:34 +00:00
wxString s = bozo;
UTF8 b = s;
if( s.IsEmpty() )
{
printf( "string is empty\n" );
}
if( s != bozo.wx_str() )
{
printf( "wxString conversion error\n" );
}
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;
}