Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Better text printing for UTF-8 characters

  • Loading branch information
slouken committed Jun 25, 2013
1 parent 95014b7 commit 1a9b3ae9da851a837929a165d9038034e236dbdd
Showing with 9 additions and 1 deletion.
  1. +9 −1 test/checkkeys.c
@@ -117,7 +117,15 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
static void
PrintText(char *text)
{
SDL_Log("Text: %s\n", text);
unsigned char *spot, expanded[1024];

expanded[0] = '\0';
for ( spot = text; *spot; ++spot )
{
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", *spot);
}
SDL_Log("Text (%s): \"%s%s\"\n", expanded, *text == '"' ? "\\" : "", text);
}

int

0 comments on commit 1a9b3ae

Please sign in to comment.