You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
763 B

  1. #include <string>
  2. #include <utf8.h>
  3. #include <wx/string.h>
  4. void callee( const wxString& aString )
  5. {
  6. UTF8 arg = aString;
  7. printf( "%s: '%s'\n", __func__, arg.c_str() );
  8. }
  9. int main( int argc, char** argv )
  10. {
  11. UTF8 bozo = "This is a test of UTF-8: ü‱☺😕😱";
  12. callee( bozo );
  13. wxString s = bozo;
  14. UTF8 b = s;
  15. if( s.IsEmpty() )
  16. {
  17. printf( "string is empty\n" );
  18. }
  19. if( s != bozo.wx_str() )
  20. {
  21. printf( "wxString conversion error\n" );
  22. }
  23. if( b != bozo )
  24. {
  25. printf( "From string conversion error\n" );
  26. }
  27. auto pos = bozo.begin();
  28. auto end = bozo.end();
  29. while( pos != end )
  30. {
  31. printf( "%c", *pos++ );
  32. }
  33. printf("\n");
  34. return 0;
  35. }